[dia] Bug 739691 - Avoid crash with missing shape icon



commit 58fab9d9a8f0b0cb460b4746da1d4eb9d60664f9
Author: Hans Breuer <hans breuer org>
Date:   Fri Nov 7 20:10:43 2014 +0100

    Bug 739691 - Avoid crash with missing shape icon

 app/sheets_dialog_callbacks.c |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/app/sheets_dialog_callbacks.c b/app/sheets_dialog_callbacks.c
index 0fb96c6..b21042a 100644
--- a/app/sheets_dialog_callbacks.c
+++ b/app/sheets_dialog_callbacks.c
@@ -1715,11 +1715,14 @@ write_user_sheet(Sheet *sheet)
       copy_file(som->svg_filename, dest);
       g_free(dest);
 
-      basename = g_path_get_basename(som->sheet_object.pixmap_file);
-      dest = g_strdup_printf("%s%s%s", dia_user_shapes, G_DIR_SEPARATOR_S, basename);
-      g_free(basename);
-      copy_file(som->sheet_object.pixmap_file, dest);
-      g_free(dest);
+      /* avoid crashing when there is no icon */
+      if (som->sheet_object.pixmap_file) {
+       basename = g_path_get_basename(som->sheet_object.pixmap_file);
+       dest = g_strdup_printf("%s%s%s", dia_user_shapes, G_DIR_SEPARATOR_S, basename);
+       g_free(basename);
+       copy_file(som->sheet_object.pixmap_file, dest);
+       g_free(dest);
+      }
     }
 
     sheetobject = &som->sheet_object;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]