[glom/feature_backup2: 5/6] Document: Avoid a crash when creating the parent directory.



commit 281caea61b240ad6737e0c2bc668ab2d57a92cf3
Author: Murray Cumming <murrayc murrayc com>
Date:   Fri Jul 2 10:11:32 2010 +0200

    Document: Avoid a crash when creating the parent directory.
    
    	* glom/libglom/docment/bakery/document.cc: write_to_disk(): Check the
    	result of Gio::File::get_parent() for null, because that happens if we
    	provide a path instead of a URI.

 ChangeLog                                |   16 ++++++++--------
 glom/libglom/document/bakery/document.cc |    3 ++-
 2 files changed, 10 insertions(+), 9 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 53f459e..cad2a5d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,20 +1,20 @@
 2010-07-02  Murray Cumming  <murrayc murrayc com>
 
+	Document: Avoid a crash when creating the parent directory.
+	
+	* glom/libglom/docment/bakery/document.cc: write_to_disk(): Check the 
+	result of Gio::File::get_parent() for null, because that happens if we 
+	provide a path instead of a URI.
+	
+2010-07-02  Murray Cumming  <murrayc murrayc com>
+
 	Save as Example: Reset the old file URI and allow auto-saving again.
 
 	* glom/application.cc: on_menu_file_save_as_example(): reset the old file 
 	URI and turn auto-saving back on again, because it makes no sense to leave 
 	the user editing an example document. This is really an export anyway.
 	This allows the user to close the window again after saving as an example.
-
-2010-07-02  Murray Cumming  <murrayc murrayc com>
-
-	Document: Avoid a crash when creating the parent directory.
 	
-	* glom/libglom/docment/bakery/document.cc: write_to_disk(): Check the 
-	result of Gio::File::get_parent() for null, because that happens if we 
-	provide a path instead of a URI.
-
 2010-07-01  Murray Cumming  <murrayc murrayc com>
 
 	Add Save Backup menu item.
diff --git a/glom/libglom/document/bakery/document.cc b/glom/libglom/document/bakery/document.cc
index 5c71d46..798cec2 100644
--- a/glom/libglom/document/bakery/document.cc
+++ b/glom/libglom/document/bakery/document.cc
@@ -311,7 +311,8 @@ bool Document::write_to_disk()
       Glib::RefPtr<Gio::File> parent = file->get_parent();
       try
       {
-        parent->make_directory_with_parents();
+        if(parent) //It will be empty if file was the root node of the filesystem.
+          parent->make_directory_with_parents();
       }
       catch(const Gio::Error& ex)
       {



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