Fix missing error check.
authorCarl Worth <cworth@cworth.org>
Thu, 22 Oct 2009 22:33:56 +0000 (15:33 -0700)
committerCarl Worth <cworth@cworth.org>
Thu, 22 Oct 2009 22:33:56 +0000 (15:33 -0700)
The notmuch_message_file_open function is perfectly capable of
returning NULL. So check for it.

database.cc

index 578dce4b70c2d1740bb57f5c34a6f4a7b0c10214..1c0410c2c176a24f4897a33a70f945129c617aa9 100644 (file)
@@ -502,6 +502,10 @@ notmuch_database_add_message (notmuch_database_t *notmuch,
     unsigned int i;
 
     message = notmuch_message_file_open (filename);
+    if (message == NULL) {
+       ret = NOTMUCH_STATUS_FILE_ERROR;
+       goto DONE;
+    }
 
     notmuch_message_file_restrict_headers (message,
                                           "date",