Error with g_critical instead of g_assert on invalid variable types.
[pspp-builds.git] / src / ui / gui / var-type-dialog.c
index a4c2a22769c3be34911893232659125d14dd726b..ea3d2e098a23c5eb464fea1ab596e6c09e4460cc 100644 (file)
@@ -1,5 +1,5 @@
 /* PSPPIRE - a graphical user interface for PSPP.
-    Copyright (C) 2005, 2006, 2010, 2011  Free Software Foundation
+    Copyright (C) 2005, 2006, 2010, 2011, 2012  Free Software Foundation
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -28,7 +28,7 @@
 #include "data/settings.h"
 #include "data/variable.h"
 #include "libpspp/message.h"
-#include "ui/gui/helper.h"
+#include "ui/gui/builder-wrapper.h"
 #include "ui/gui/var-type-dialog.h"
 
 struct tgs
@@ -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;
       }