[gnome-software] trivial: Fix a critical warning if XDG_CURRENT_DESKTOP is unset
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] trivial: Fix a critical warning if XDG_CURRENT_DESKTOP is unset
- Date: Thu, 19 Oct 2017 17:22:26 +0000 (UTC)
commit ccc2ca31d7c18bdce140b7b0be48ff3ad577aded
Author: Richard Hughes <richard hughsie com>
Date: Wed Oct 18 19:46:22 2017 +0100
trivial: Fix a critical warning if XDG_CURRENT_DESKTOP is unset
plugins/core/gs-appstream.c | 24 +++++++++++++-----------
1 files changed, 13 insertions(+), 11 deletions(-)
---
diff --git a/plugins/core/gs-appstream.c b/plugins/core/gs-appstream.c
index 8350697..1d288ce 100644
--- a/plugins/core/gs-appstream.c
+++ b/plugins/core/gs-appstream.c
@@ -706,20 +706,22 @@ gs_appstream_refine_app (GsPlugin *plugin,
*/
array = as_app_get_compulsory_for_desktops (item);
current_desktop = g_getenv ("XDG_CURRENT_DESKTOP");
- xdg_current_desktops = g_strsplit (current_desktop, ":", 0);
- for (i = 0; i < array->len; i++) {
- tmp = g_ptr_array_index (array, i);
- /* if the value has a :, check the whole string */
- if (g_strstr_len (tmp, -1, ":")) {
- if (g_strcmp0 (current_desktop, tmp) == 0) {
+ if (current_desktop != NULL) {
+ xdg_current_desktops = g_strsplit (current_desktop, ":", 0);
+ for (i = 0; i < array->len; i++) {
+ tmp = g_ptr_array_index (array, i);
+ /* if the value has a :, check the whole string */
+ if (g_strstr_len (tmp, -1, ":")) {
+ if (g_strcmp0 (current_desktop, tmp) == 0) {
+ gs_app_add_quirk (app, AS_APP_QUIRK_COMPULSORY);
+ break;
+ }
+ /* otherwise check if any element matches this one */
+ } else if (g_strv_contains ((const gchar * const *) xdg_current_desktops,
+ tmp)) {
gs_app_add_quirk (app, AS_APP_QUIRK_COMPULSORY);
break;
}
- /* otherwise check if any element matches this one */
- } else if (g_strv_contains ((const gchar * const *) xdg_current_desktops,
- tmp)) {
- gs_app_add_quirk (app, AS_APP_QUIRK_COMPULSORY);
- break;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]