[epiphany/mwleeds/webapp-dbus-api: 15/17] profile-migrator: Fix GFileEnumerator error handling




commit c6eaa20dcf1b2396f2bdf6a0448b560765d58334
Author: Phaedrus Leeds <mwleeds protonmail com>
Date:   Wed Feb 23 10:48:28 2022 -0800

    profile-migrator: Fix GFileEnumerator error handling
    
    Don't dereference a NULL GError in case the directory being iterated
    over is empty. This probably hasn't come up in practice since
    ~/.local/share is hardly ever empty.

 src/profile-migrator/ephy-profile-migrator.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/profile-migrator/ephy-profile-migrator.c b/src/profile-migrator/ephy-profile-migrator.c
index 33939e507..8267d3fd0 100644
--- a/src/profile-migrator/ephy-profile-migrator.c
+++ b/src/profile-migrator/ephy-profile-migrator.c
@@ -1305,7 +1305,7 @@ migrate_webapp_names (void)
     return;
 
   info = g_file_enumerator_next_file (children, NULL, &error);
-  if (!info) {
+  if (error) {
     g_warning ("Cannot enumerate profile directory: %s", error->message);
     return;
   }
@@ -1520,7 +1520,7 @@ migrate_pre_flatpak_webapps (void)
   }
 
   info = g_file_enumerator_next_file (children, NULL, &error);
-  if (!info) {
+  if (error) {
     g_warning ("Cannot enumerate profile directory: %s", error->message);
     return;
   }


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