* mu-find: some fixes for the nothing-matches case

This commit is contained in:
Dirk-Jan C. Binnema
2010-02-02 08:46:55 +02:00
parent ed9f59f0b4
commit 1d75aea016

View File

@ -122,6 +122,9 @@ print_rows (MuMsgIterXapian *iter, const char *fields)
size_t count = 0; size_t count = 0;
const char* myfields; const char* myfields;
if (mu_msg_iter_xapian_is_null (iter))
return 0;
do { do {
int len = 0; int len = 0;
@ -172,6 +175,9 @@ make_links (MuMsgIterXapian *iter, const char* linksdir, gboolean clearlinks)
if (!create_or_clear_linksdir_maybe (linksdir, clearlinks)) if (!create_or_clear_linksdir_maybe (linksdir, clearlinks))
return 0; return 0;
if (mu_msg_iter_xapian_is_null (iter))
return 0;
pathfield = mu_msg_field_from_id (MU_MSG_FIELD_ID_PATH); pathfield = mu_msg_field_from_id (MU_MSG_FIELD_ID_PATH);
/* iterate over the found iters */ /* iterate over the found iters */
@ -196,6 +202,7 @@ make_links (MuMsgIterXapian *iter, const char* linksdir, gboolean clearlinks)
if (!mu_maildir_link (path, linksdir)) if (!mu_maildir_link (path, linksdir))
break; break;
++count; ++count;
} while (mu_msg_iter_xapian_next (iter)); } while (mu_msg_iter_xapian_next (iter));
return count; return count;
@ -233,6 +240,7 @@ run_query (MuQueryXapian *xapian, const gchar *query, MuConfigOptions *opts)
if (matches == 0) if (matches == 0)
g_printerr ("No matches found\n"); g_printerr ("No matches found\n");
mu_msg_iter_xapian_destroy (iter); mu_msg_iter_xapian_destroy (iter);
return matches > 0; return matches > 0;