From 7946115772a36f8bc255c6164703720b3a910594 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Wed, 18 Apr 2012 22:20:35 -0700 Subject: [PATCH] Revert "psppire-dict: g_return_if_fail for idx in psppire_dict_get_variable()." This reverts commit edf4f6b1f7e2b9c17cc86f1c63ff9b4b7e24af26. John pointed out that it causes the GUI to crash at startup. --- src/ui/gui/psppire-dict.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/ui/gui/psppire-dict.c b/src/ui/gui/psppire-dict.c index 16576dc3aa..04bd3e319c 100644 --- a/src/ui/gui/psppire-dict.c +++ b/src/ui/gui/psppire-dict.c @@ -464,14 +464,17 @@ psppire_dict_set_name (PsppireDict* d, gint idx, const gchar *name) -/* Return the IDXth variable in D. */ +/* 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) { g_return_val_if_fail (d, NULL); g_return_val_if_fail (d->dict, NULL); - g_return_val_if_fail (idx < 0, NULL); - g_return_val_if_fail (dict_get_var_cnt (d->dict) <= idx, NULL); + + if ( dict_get_var_cnt (d->dict) <= idx ) + return NULL; return dict_get_var (d->dict, idx); } -- 2.30.2