From cf053bc3d176906bf29ff570b2f178f32a99994b Mon Sep 17 00:00:00 2001 From: John Darrington Date: Mon, 8 Dec 2008 18:58:05 +0900 Subject: [PATCH] Prevent widths less than 1 --- lib/gtksheet/psppire-axis-impl.c | 1 + src/ui/gui/psppire-data-editor.c | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) 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); } -- 2.30.2