[giv] Fixed crash when visiting multiple images without a file type extension (e.g. DICOM).



commit 9537cbc546ebc74f0ece7cb3c9c341f3fecdc173
Author: Dov Grobgeld <dov grobgeld gmail com>
Date:   Wed Nov 30 22:10:50 2011 +0200

    Fixed crash when visiting multiple images without a file type extension (e.g. DICOM).

 src/giv-win.gob |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/src/giv-win.gob b/src/giv-win.gob
index 9027551..070e7cd 100644
--- a/src/giv-win.gob
+++ b/src/giv-win.gob
@@ -1460,7 +1460,10 @@ class Giv:Win from Gtk:Window
     {
         GPtrArray *string_list = (GPtrArray*)g_ptr_array_index(selfp->filename_list, index);
         gchar *filename0 = (gchar*)g_ptr_array_index(string_list, 0);
-        return g_strrstr(filename0, ".")+1;
+        const gchar *dot_pos = g_strrstr(filename0, ".");
+        if (!dot_pos)
+            return NULL;
+        return dot_pos;
     }
 }
 
@@ -1655,6 +1658,11 @@ cb_key_press_event (GtkWidget * widget,
                 break;
 
             const gchar *new_type = giv_win_get_filetype_for_index(self,new_index);
+            if (org_type == NULL && new_type == NULL)
+                break;
+            if (!org_type || !new_type)
+                continue;
+            
             if (g_ascii_strcasecmp(org_type,new_type)!=0)
                 continue;
             break;



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