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



commit 0ee84c7936ef45946a64043bd0985ad8ed347da4
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 3d7d603..b838039 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]