From: theAdib Date: Wed, 29 Apr 2009 20:37:10 +0000 (+0000) Subject: FIX for BUG 368879: crash on 'save a copy as' when document has no filename yet X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=57e08398f414bcc6ed4b2e7b1e5aa3983d4e5d60;p=inkscape.git FIX for BUG 368879: crash on 'save a copy as' when document has no filename yet --- diff --git a/src/file.cpp b/src/file.cpp index 0bc68f862..f8d631455 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -89,6 +89,10 @@ void dump_ustr(Glib::ustring const &ustr); // what gets passed here is not actually an URI... it is an UTF-8 encoded filename (!) static void sp_file_add_recent(gchar const *uri) { + if(uri == NULL) { + g_warning("sp_file_add_recent: uri == NULL"); + return; + } GtkRecentManager *recent = gtk_recent_manager_get_default(); gchar *fn = g_filename_from_utf8(uri, -1, NULL, NULL, NULL); if (fn) { @@ -813,7 +817,7 @@ sp_file_save_dialog(Gtk::Window &parentWindow, SPDocument *doc, bool is_copy) success = file_save(parentWindow, doc, fileName, selectionType, TRUE, !is_copy); - if (success) { + if (success && SP_DOCUMENT_URI(doc)) { sp_file_add_recent(SP_DOCUMENT_URI(doc)); } @@ -1170,7 +1174,7 @@ sp_file_export_dialog(void *widget) export_path = export_path_local; //# Show the SaveAs dialog - Inkscape::UI::Dialog::FileExportDialog *exportDialogInstance = + Inkscape::UI::Dialog::FileExportDialog *exportDialogInstance = Inkscape::UI::Dialog::FileExportDialog::create( export_path, Inkscape::UI::Dialog::EXPORT_TYPES,