Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike McCormack <mike@codeweavers.com>2006-04-05 18:22:52 +0400
committerJunio C Hamano <junkio@cox.net>2006-04-06 00:00:03 +0400
commit1cd88cc9e6d6f83fed554419166a52a900e6f9a5 (patch)
tree360acf830d3ab86e3259a825656db95574983eef /imap-send.c
parent521a3f676794987bfd03703fe58fbec46ed69d49 (diff)
Avoid a divide by zero if there's no messages to send.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'imap-send.c')
-rw-r--r--imap-send.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/imap-send.c b/imap-send.c
index f3cb79b1f8..ea56dc9ae5 100644
--- a/imap-send.c
+++ b/imap-send.c
@@ -1332,6 +1332,12 @@ main(int argc, char **argv)
return 1;
}
+ total = count_messages( &all_msgs );
+ if (!total) {
+ fprintf(stderr,"no messages to send\n");
+ return 1;
+ }
+
/* write it to the imap server */
ctx = imap_open_store( &server );
if (!ctx) {
@@ -1339,7 +1345,6 @@ main(int argc, char **argv)
return 1;
}
- total = count_messages( &all_msgs );
fprintf( stderr, "sending %d message%s\n", total, (total!=1)?"s":"" );
ctx->name = imap_folder;
while (1) {