Skip to content

Commit

Permalink
Avoid a divide by zero if there's no messages to send.
Browse files Browse the repository at this point in the history
Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
Mike McCormack authored and Junio C Hamano committed Apr 5, 2006
1 parent 521a3f6 commit 1cd88cc
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion imap-send.c
Original file line number Diff line number Diff line change
Expand Up @@ -1332,14 +1332,19 @@ 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) {
fprintf( stderr,"failed to open store\n");
return 1;
}

total = count_messages( &all_msgs );
fprintf( stderr, "sending %d message%s\n", total, (total!=1)?"s":"" );
ctx->name = imap_folder;
while (1) {
Expand Down

0 comments on commit 1cd88cc

Please sign in to comment.