[gnome-software/gnome-40: 1/2] os-release: Handle NULL OS name or version




commit cb4f32aecf5c884b799a0afcb2fdf36fcd35657d
Author: Philip Withnall <pwithnall endlessos org>
Date:   Mon May 17 10:36:15 2021 +0100

    os-release: Handle NULL OS name or version
    
    Either may be NULL, but shouldn’t end up as ‘(null)’ in the app ID, as
    that breaks subsequent XPath queries in the appstream plugin.
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>
    
    Fixes: #1254

 plugins/core/gs-plugin-os-release.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/plugins/core/gs-plugin-os-release.c b/plugins/core/gs-plugin-os-release.c
index 03aee6fcd..977aae0da 100644
--- a/plugins/core/gs-plugin-os-release.c
+++ b/plugins/core/gs-plugin-os-release.c
@@ -73,8 +73,8 @@ gs_plugin_setup (GsPlugin *plugin, GCancellable *cancellable, GError **error)
                                id = g_strdup_printf ("%s.%s.%s-%s",
                                                      split[1],
                                                      split[0],
-                                                     name,
-                                                     version);
+                                                     (name != NULL) ? name : "unnamed",
+                                                     (version != NULL) ? version : "unversioned");
                                gs_app_set_id (priv->app_system, id);
                        }
                }


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