@matheusbsbs / matheus-bagliano / commits / 1cd88cc9e6
Fork 0

Avoid a divide by zero if there's no messages to send.

Signed-off-by: Junio C Hamano <junkio@cox.net>

Mike McCormack committed Apr 5, 2006 at 23:22 UTC 1cd88cc9e6d6f83fed554419166a52a900e6f9a5
1 file changed +6 -1
imap-send.c
+6 -1
@@ -1332,6 +1332,12 @@ main(int argc, char **argv)
1332 return 1;
1333 }
1334
1335 + total = count_messages( &all_msgs );
1336 + if (!total) {
1337 + fprintf(stderr,"no messages to send\n");
1338 + return 1;
1339 + }
1340 +
1341 /* write it to the imap server */
1342 ctx = imap_open_store( &server );
1343 if (!ctx) {
@@ -1339,7 +1345,6 @@ main(int argc, char **argv)
1345 return 1;
1346 }
1347
1342 - total = count_messages( &all_msgs );
1348 fprintf( stderr, "sending %d message%s\n", total, (total!=1)?"s":"" );
1349 ctx->name = imap_folder;
1350 while (1) {