[gnome-software: 1/2] gs-plugin-loader: Fix NULL reference




commit 2736e87ecd64e2e19731e774bcde3ee315bfef38
Author: Philip Withnall <pwithnall endlessos org>
Date:   Fri Feb 4 14:53:39 2022 +0000

    gs-plugin-loader: Fix NULL reference
    
    It turns out `app` can be `NULL` here, so guard against `g_object_ref
    (NULL)`.
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>

 lib/gs-plugin-loader.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/lib/gs-plugin-loader.c b/lib/gs-plugin-loader.c
index 8b0dc7537..6c65e41fa 100644
--- a/lib/gs-plugin-loader.c
+++ b/lib/gs-plugin-loader.c
@@ -377,7 +377,8 @@ gs_plugin_loader_claim_error (GsPluginLoader *plugin_loader,
        }
 
        /* set the app and origin IDs if we managed to scrape them from the error above */
-       event_app = g_object_ref (app);
+       if (app != NULL)
+               event_app = g_object_ref (app);
        event_origin = NULL;
 
        if (plugin != NULL && as_utils_data_id_valid (app_id)) {


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