[gnome-builder/gnome-builder-3-24] flatpak: handle NULL parameters gracefully
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/gnome-builder-3-24] flatpak: handle NULL parameters gracefully
- Date: Thu, 18 May 2017 03:16:13 +0000 (UTC)
commit e58cc83621e869b033cf2898985e9616e30a4ef4
Author: Christian Hergert <chergert redhat com>
Date: Wed May 17 20:14:19 2017 -0700
flatpak: handle NULL parameters gracefully
These can happen in various places where we read an id/branch/arch out of
ancillary data and it is empty. In most places we use g_strcmp0() to be
NULL-safe, to to simplify those code-paths, just handle NULL here.
https://bugzilla.gnome.org/show_bug.cgi?id=782678
plugins/flatpak/gbp-flatpak-application-addin.c | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/plugins/flatpak/gbp-flatpak-application-addin.c b/plugins/flatpak/gbp-flatpak-application-addin.c
index 5312c82..5583079 100644
--- a/plugins/flatpak/gbp-flatpak-application-addin.c
+++ b/plugins/flatpak/gbp-flatpak-application-addin.c
@@ -681,10 +681,16 @@ gbp_flatpak_application_addin_has_runtime (GbpFlatpakApplicationAddin *self,
IDE_ENTRY;
- g_assert (GBP_IS_FLATPAK_APPLICATION_ADDIN (self));
- g_assert (id != NULL);
- g_assert (arch != NULL);
- g_assert (branch != NULL);
+ g_return_val_if_fail (GBP_IS_FLATPAK_APPLICATION_ADDIN (self), FALSE);
+
+ if (id == NULL)
+ return FALSE;
+
+ if (arch == NULL)
+ arch = flatpak_get_default_arch ();
+
+ if (branch == NULL)
+ branch = "master";
IDE_TRACE_MSG ("Looking for runtime %s/%s/%s", id, arch, branch);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]