Error with g_critical instead of g_assert on invalid variable types.
authorJohn Darrington <john@darrington.wattle.id.au>
Thu, 2 Feb 2012 20:46:39 +0000 (21:46 +0100)
committerJohn Darrington <john@darrington.wattle.id.au>
Thu, 2 Feb 2012 20:46:39 +0000 (21:46 +0100)
src/ui/gui/var-type-dialog.c

index fb9fc6d9f143a561be032e00fbc254cc8d88202c..ea3d2e098a23c5eb464fea1ab596e6c09e4460cc 100644 (file)
@@ -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;
       }