[f-spot] No longer crash FolderTree for non-file URIs.



commit daf81201e58298df90def64e7f09b63c85412aaf
Author: Ruben Vermeersch <ruben savanne be>
Date:   Tue Jul 13 15:39:25 2010 +0200

    No longer crash FolderTree for non-file URIs.
    
    Filtering for those is broken though.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=622318

 src/Widgets/FolderTreeModel.cs |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/src/Widgets/FolderTreeModel.cs b/src/Widgets/FolderTreeModel.cs
index f9113b3..1afd1da 100644
--- a/src/Widgets/FolderTreeModel.cs
+++ b/src/Widgets/FolderTreeModel.cs
@@ -111,7 +111,11 @@ namespace FSpot.Widgets
 				
 				int count = Convert.ToInt32 (reader["count"]);
 				
-				string[] segments = base_uri.LocalPath.TrimEnd ('/').Split ('/');
+				// FIXME: this is a workaround hack to stop things from crashing - https://bugzilla.gnome.org/show_bug.cgi?id=622318
+				int index = base_uri.ToString ().IndexOf ("://");
+				var hack = base_uri.ToString ().Substring (index + 3);
+				hack = hack.IndexOf ('/') == 0 ? hack : "/" + hack;
+				string[] segments = hack.TrimEnd ('/').Split ('/');
 
 				/* First segment contains nothing (since we split by /), so we
 				 * can overwrite the first segment for our needs and put the



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