Find dialog: Don't crash when searching for a non-existant label.
authorJohn Darrington <john@darrington.wattle.id.au>
Tue, 13 Nov 2012 18:42:34 +0000 (19:42 +0100)
committerJohn Darrington <john@darrington.wattle.id.au>
Tue, 13 Nov 2012 18:42:34 +0000 (19:42 +0100)
src/ui/gui/find-dialog.c

index 0f856f94629d29c58383d9a1fc3d078015b47bf4..8dea41768ae6fba92d39f94cd037edc8f2d8ae30 100644 (file)
@@ -471,8 +471,13 @@ string_label_compare (const struct comparator *cmptr,
   const struct string_comparator *ssc =
     (const struct string_comparator *) cmptr;
 
+  int width;
+
   const char *text = var_lookup_value_label (cmptr->var, val);
-  int width = strlen (text);
+  if (text == NULL)
+    return false;
+
+  width = strlen (text);
 
   assert ( cmptr->flags & STR_CMP_LABELS);