[epiphany/gnome-3-24-loki] Make bookmarks import not crash



commit e1e540af0be964c38f7da6590dafed9e76321686
Author: Michael Catanzaro <mcatanzaro igalia com>
Date:   Thu Sep 21 19:01:30 2017 -0500

    Make bookmarks import not crash
    
    This isn't an elementary bug, it's just nobody has ever tested bookmarks
    import without a firefox profile before.

 src/window-commands.c |   22 ++++++++++++----------
 1 files changed, 12 insertions(+), 10 deletions(-)
---
diff --git a/src/window-commands.c b/src/window-commands.c
index 45bc798..f9d0479 100644
--- a/src/window-commands.c
+++ b/src/window-commands.c
@@ -159,18 +159,20 @@ get_firefox_profiles (void)
   channel = g_io_channel_new_file (filename, "r", NULL);
   g_free (filename);
 
-  do {
-    g_io_channel_read_line (channel, &line, &length, NULL, NULL);
+  if (channel) {
+    do {
+      g_io_channel_read_line (channel, &line, &length, NULL, NULL);
 
-    profile = g_strdup_printf ("[Profile%d]\n", count);
-    if (g_strcmp0 (line, profile) == 0) {
-      profiles = g_slist_append (profiles, get_path (channel));
+      profile = g_strdup_printf ("[Profile%d]\n", count);
+      if (g_strcmp0 (line, profile) == 0) {
+        profiles = g_slist_append (profiles, get_path (channel));
 
-      count++;
-    }
-    g_free (profile);
-    g_free (line);
-  } while (length != 0);
+        count++;
+      }
+      g_free (profile);
+      g_free (line);
+    } while (length != 0);
+  }
 
   return profiles;
 }


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