[gthumb] fixed crash when saving an image



commit a8ebe48c8d705882fcc2660b273fa2f7161a9bf6
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Wed Jan 29 11:57:14 2020 +0100

    fixed crash when saving an image

 gthumb/gth-file-chooser-dialog.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/gthumb/gth-file-chooser-dialog.c b/gthumb/gth-file-chooser-dialog.c
index 57f7d3db..dc1de5a7 100644
--- a/gthumb/gth-file-chooser-dialog.c
+++ b/gthumb/gth-file-chooser-dialog.c
@@ -219,22 +219,22 @@ static Format *
 get_format_from_extension (GthFileChooserDialog *self,
                           const char           *filename)
 {
-       char  *ext;
-       GList *scan;
+       char       *ext;
+       const char *only_ext;
+       GList      *scan;
 
        ext = _g_uri_get_extension (filename);
        if (ext == NULL)
                return NULL;
 
-       if (ext[0] == '.')
-               ext++;
+       only_ext = (ext[0] == '.') ? ext + 1 : ext;
 
        for (scan = self->priv->supported_formats; scan; scan = scan->next) {
                Format *format = scan->data;
                int     i;
 
                for (i = 0; format->extensions[i] != NULL; i++)
-                       if (g_ascii_strcasecmp (ext, format->extensions[i]) == 0) {
+                       if (g_ascii_strcasecmp (only_ext, format->extensions[i]) == 0) {
                                g_free (ext);
                                return format;
                        }


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