GNOME Bugzilla – Bug 619968
Segfault: SafeUriExtension GetExtension() expects all files to have an extension
Last modified: 2010-05-29 12:43:49 UTC
Call to Substring will result in segfault when abs_uri doesnt contain an '.' (mdb) list /home/johan/SRC/f-spot/src/Core/SafeUriExtensions.cs:23 22 } 23 24 public static string GetExtension (this SafeUri uri) 25 { 26 var abs_uri = uri.AbsoluteUri; 27 return abs_uri.Substring (abs_uri.LastIndexOf ('.')); 28 } Fix, check the result of LastIndexOf and return empty string when no . found.
Created attachment 162266 [details] [review] Fix extension detection for files without extension. Also added a unit test to test these scenarios.
Fixed, thanks for reporting this!