]> git.saurik.com Git - wxWidgets.git/commitdiff
check that filename pointer is non-NULL before using it, not after (coverity warning...
authorVadim Zeitlin <vadim@wxwidgets.org>
Fri, 30 Mar 2007 13:06:29 +0000 (13:06 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Fri, 30 Mar 2007 13:06:29 +0000 (13:06 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45137 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/gtk/assertdlg_gtk.c

index 85c4666b421f7cb235c7d96bc3aff95119e83509..5355e8b2f2b9a5c50fc31b4a9e46f5202fe0f6b2 100644 (file)
@@ -181,18 +181,23 @@ void gtk_assert_dialog_save_backtrace_callback (GtkWidget *widget, GtkAssertDial
         FILE *fp;
 
         filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
         FILE *fp;
 
         filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
-        msg = gtk_assert_dialog_get_message (dlg);
-        backtrace = gtk_assert_dialog_get_backtrace (dlg);
-
-        /* open the file and write all info inside it */
-        fp = fopen (filename, "w");
-        if (fp)
-            fprintf (fp, "ASSERT INFO:\n%s\n\nBACKTRACE:\n%s", msg, backtrace);
-
-        g_free (filename);
-        g_free (msg);
-        g_free (backtrace);
-        fclose (fp);
+        if ( filename )
+        {
+            msg = gtk_assert_dialog_get_message (dlg);
+            backtrace = gtk_assert_dialog_get_backtrace (dlg);
+
+            /* open the file and write all info inside it */
+            fp = fopen (filename, "w");
+            if (fp)
+            {
+                fprintf (fp, "ASSERT INFO:\n%s\n\nBACKTRACE:\n%s", msg, backtrace);
+                fclose (fp);
+            }
+
+            g_free (filename);
+            g_free (msg);
+            g_free (backtrace);
+        }
     }
 
     gtk_widget_destroy (dialog);
     }
 
     gtk_widget_destroy (dialog);