commit ec031663e58b61102b1a0954bb6fc9c74217a76f
Author: Matt Fowles <matt.fowles@gmail.com>
Date:   Thu Jan 28 10:51:21 2010 -0500

    fix an possibly unitialized variable compiler warning

diff --git a/lib/message.cc b/lib/message.cc
index f0e905b..a1d03eb 100644
--- a/lib/message.cc
+++ b/lib/message.cc
@@ -438,6 +438,7 @@ notmuch_message_get_filename (notmuch_message_t *message)
     const char *db_path, *directory, *basename;
     unsigned int directory_id;
     void *local = talloc_new (message);
+    int old_direntry;
 
     if (message->filename)
 	return message->filename;
@@ -445,21 +446,21 @@ notmuch_message_get_filename (notmuch_message_t *message)
     i = message->doc.termlist_begin ();
     i.skip_to (prefix);
 
-    if (i != message->doc.termlist_end ())
+    /* A message document created by an old version of notmuch
+     * (prior to rename support) will have the filename in the
+     * data of the document rather than as a file-direntry term.
+     *
+     * It would be nice to do the upgrade of the document directly
+     * here, but the database is likely open in read-only mode. */
+    if (i != message->doc.termlist_end ()) {
 	direntry = talloc_strdup (local, (*i).c_str ());
+        old_direntry = strncmp (direntry, prefix, prefix_len);
+    } else {
+        old_direntry = 1;
+    }
 
-    if (i == message->doc.termlist_end () ||
-	strncmp (direntry, prefix, prefix_len))
-    {
-	/* A message document created by an old version of notmuch
-	 * (prior to rename support) will have the filename in the
-	 * data of the document rather than as a file-direntry term.
-	 *
-	 * It would be nice to do the upgrade of the document directly
-	 * here, but the database is likely open in read-only mode. */
-	const char *data;
-
-	data = message->doc.get_data ().c_str ();
+    if (old_direntry) {
+	const char *data = message->doc.get_data ().c_str ();
 
 	if (data == NULL)
 	    INTERNAL_ERROR ("message with no filename");
