From f7a566e2ab2f51d8e3a8b4a96232a364e11e46bd Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sat, 12 Jan 2019 17:54:03 -0500 Subject: [PATCH] Make sure we have IDs and display names Return non-NULL strings from flatpak_dir_get_id() and flatpak_dir_get_display_name() for user installations, to save library users the hassle of dealing with NULL return values. Closes: #2583 Approved by: alexlarsson --- common/flatpak-dir.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/common/flatpak-dir.c b/common/flatpak-dir.c index eb9295c8..12e0a8a1 100644 --- a/common/flatpak-dir.c +++ b/common/flatpak-dir.c @@ -1670,6 +1670,9 @@ flatpak_dir_get_changed_path (FlatpakDir *self) const char * flatpak_dir_get_id (FlatpakDir *self) { + if (self->user) + return "user"; + if (self->extra_data != NULL) return self->extra_data->id; @@ -1709,6 +1712,9 @@ flatpak_dir_get_name_cached (FlatpakDir *self) const char * flatpak_dir_get_display_name (FlatpakDir *self) { + if (self->user) + return _("User installation"); + if (self->extra_data != NULL) return self->extra_data->display_name;