From 703c8f9511c6f96023fb180b0e9d831e762befc9 Mon Sep 17 00:00:00 2001 From: David Bremner Date: Sun, 29 Mar 2015 09:39:46 +0200 Subject: [PATCH] test: make one error output test more robust. Since notmuch_database_status_string can return NULL, passing it directly to fputs is not a good idea. --- test/T560-lib-error.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/test/T560-lib-error.sh b/test/T560-lib-error.sh index 67a5e8df..828a44b7 100755 --- a/test/T560-lib-error.sh +++ b/test/T560-lib-error.sh @@ -126,9 +126,10 @@ int main (int argc, char** argv) fprintf (stderr, "error opening database: %d\n", stat); } stat = notmuch_database_add_message (db, "/nonexistent", NULL); - if (stat) - fputs (notmuch_database_status_string (db), stderr); - + if (stat) { + char *status_string = notmuch_database_status_string (db); + if (status_string) fputs (status_string, stderr); + } } EOF cat <<'EOF' >EXPECTED -- 2.26.2