From 2d9ee2dd5f5fbaeda0caf5a19ad4f018f4b22bc3 Mon Sep 17 00:00:00 2001 From: John Darrington Date: Thu, 2 Feb 2012 21:46:39 +0100 Subject: [PATCH] Error with g_critical instead of g_assert on invalid variable types. --- src/ui/gui/var-type-dialog.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/ui/gui/var-type-dialog.c b/src/ui/gui/var-type-dialog.c index fb9fc6d9..ea3d2e09 100644 --- a/src/ui/gui/var-type-dialog.c +++ b/src/ui/gui/var-type-dialog.c @@ -807,14 +807,16 @@ on_var_type_ok_clicked (GtkWidget *w, gpointer data) break; case BUTTON_DATE: case BUTTON_CUSTOM: - g_assert (fmt_check_output (&dialog->fmt_l)); - result = memcpy (&spec, &dialog->fmt_l, sizeof (struct fmt_spec)); + if (! fmt_check_output (&dialog->fmt_l)) + g_critical ("Invalid variable format"); + else + result = memcpy (&spec, &dialog->fmt_l, sizeof (struct fmt_spec)); break; case BUTTON_DOLLAR: result = make_output_format_try (&spec, FMT_DOLLAR, width, decimals); break; default: - g_print ("Unknown variable type: %d\n", dialog->active_button) ; + g_critical ("Unknown variable type: %d", dialog->active_button) ; result = false; break; } -- 2.30.2