[gnome-builder] flatpak: Avoid causing json-glib to print a warning
- From: Matthew Leeds <mwleeds src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] flatpak: Avoid causing json-glib to print a warning
- Date: Tue, 20 Dec 2016 04:42:17 +0000 (UTC)
commit 0928e27b24d9ec65cab305e5adeea142d3189d30
Author: Matthew Leeds <mleeds redhat com>
Date: Mon Dec 19 22:21:53 2016 -0600
flatpak: Avoid causing json-glib to print a warning
This commit makes Builder avoid calling json_object_get_array_member
when the member doesn't exist (when the flatpak manifest doesn't have
nested modules), which avoids an unnecessary warning message.
plugins/flatpak/gbp-flatpak-runtime.c | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/plugins/flatpak/gbp-flatpak-runtime.c b/plugins/flatpak/gbp-flatpak-runtime.c
index 3ea8315..03d6f55 100644
--- a/plugins/flatpak/gbp-flatpak-runtime.c
+++ b/plugins/flatpak/gbp-flatpak-runtime.c
@@ -121,10 +121,14 @@ manifest_has_multiple_modules (JsonObject *object)
else
{
object = json_array_get_object_element (modules, 0);
- modules = json_object_get_array_member (object, "modules");
- if (modules == NULL)
- return FALSE;
- return (json_array_get_length (modules) > 0);
+ if (json_object_has_member (object, "modules"))
+ {
+ modules = json_object_get_array_member (object, "modules");
+ if (modules == NULL)
+ return FALSE;
+ return (json_array_get_length (modules) > 0);
+ }
+ return FALSE;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]