From: John Darrington Date: Mon, 8 Dec 2008 11:26:56 +0000 (+0900) Subject: Don't crash when resizing columns with no associated variable X-Git-Tag: v0.7.1~54 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=59595479e350bd597b33217259f8cf996b3595b2;p=pspp-builds.git Don't crash when resizing columns with no associated variable --- diff --git a/src/ui/gui/psppire-data-editor.c b/src/ui/gui/psppire-data-editor.c index 0fe4f680..92250255 100644 --- a/src/ui/gui/psppire-data-editor.c +++ b/src/ui/gui/psppire-data-editor.c @@ -274,6 +274,9 @@ rewidth_variable (GtkWidget *w, gint unit, glong size) const PsppireDict *dict = de->data_store->dict; struct variable *var = psppire_dict_get_variable (dict, unit); + if (NULL == var) + return; + var_set_display_width (var, size / (float) width_of_m (w)); } diff --git a/src/ui/gui/psppire-dict.c b/src/ui/gui/psppire-dict.c index 4572ba0b..090ad90c 100644 --- a/src/ui/gui/psppire-dict.c +++ b/src/ui/gui/psppire-dict.c @@ -434,7 +434,9 @@ psppire_dict_set_name (PsppireDict* d, gint idx, const gchar *name) -/* Return the IDXth variable */ +/* Return the IDXth variable. + Will return NULL if IDX exceeds the number of variables in the dictionary. + */ struct variable * psppire_dict_get_variable (const PsppireDict *d, gint idx) {