From: John Darrington Date: Tue, 13 Nov 2012 18:42:34 +0000 (+0100) Subject: Find dialog: Don't crash when searching for a non-existant label. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fa710cebbb94a5fce5802902bc1cc8d52367d190;p=pspp Find dialog: Don't crash when searching for a non-existant label. --- diff --git a/src/ui/gui/find-dialog.c b/src/ui/gui/find-dialog.c index 0f856f9462..8dea41768a 100644 --- a/src/ui/gui/find-dialog.c +++ b/src/ui/gui/find-dialog.c @@ -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);