[epiphany/gnome-3-24] Make bookmarks import not crash when there's no Firefox profile



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

    Make bookmarks import not crash when there's no Firefox profile

 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 d48df1b..85f4923 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]