From 378b066491cc80d34f31683357c05be853250b80 Mon Sep 17 00:00:00 2001 From: John Darrington Date: Sun, 15 Dec 2013 17:18:41 +0100 Subject: [PATCH] Avoid crash when attempting to open files with invalid encoding --- src/ui/gui/psppire-data-window.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/ui/gui/psppire-data-window.c b/src/ui/gui/psppire-data-window.c index ca4f21e221..a0c4b9645a 100644 --- a/src/ui/gui/psppire-data-window.c +++ b/src/ui/gui/psppire-data-window.c @@ -341,17 +341,19 @@ load_file (PsppireWindow *de, const gchar *file_name, gpointer syn) { gchar *utf8_file_name; struct string filename; - ds_init_empty (&filename); utf8_file_name = g_filename_to_utf8 (file_name, -1, NULL, NULL, NULL); - + + if (NULL == utf8_file_name) + return FALSE; + + ds_init_empty (&filename); syntax_gen_string (&filename, ss_cstr (utf8_file_name)); g_free (utf8_file_name); syntax = g_strdup_printf ("GET FILE=%s.", ds_cstr (&filename)); ds_destroy (&filename); - } else { -- 2.30.2