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
This commit is contained in:
Matthias Clasen
2019-01-12 17:54:03 -05:00
committed by Atomic Bot
parent eaebab1285
commit f7a566e2ab

View File

@@ -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;