From: John Darrington Date: Mon, 8 Dec 2008 09:58:05 +0000 (+0900) Subject: Prevent widths less than 1 X-Git-Tag: v0.7.1~56 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cf053bc3d176906bf29ff570b2f178f32a99994b;p=pspp-builds.git Prevent widths less than 1 --- diff --git a/lib/gtksheet/psppire-axis-impl.c b/lib/gtksheet/psppire-axis-impl.c index 48059c1a..619e8238 100644 --- a/lib/gtksheet/psppire-axis-impl.c +++ b/lib/gtksheet/psppire-axis-impl.c @@ -398,6 +398,7 @@ resize (PsppireAxis *axis, gint posn, glong size) struct axis_node *an; g_return_if_fail (posn >= 0); + g_return_if_fail (size > 0); /* Silently ignore this request if the position is greater than the number of units in the axis */ diff --git a/src/ui/gui/psppire-data-editor.c b/src/ui/gui/psppire-data-editor.c index 52f7ddfd..0fe4f680 100644 --- a/src/ui/gui/psppire-data-editor.c +++ b/src/ui/gui/psppire-data-editor.c @@ -347,8 +347,13 @@ rewidth_variable_callback (PsppireDict *dict, gint posn, gpointer data) const struct variable *var = psppire_dict_get_variable (dict, posn); - psppire_axis_impl_resize (de->haxis, posn, m_width * - var_get_display_width (var)); + gint var_width = var_get_display_width (var); + + /* Don't allow zero width */ + if ( var_width < 1 ) + var_width = 1; + + psppire_axis_impl_resize (de->haxis, posn, m_width * var_width); }