xdg_app_installation_list_remote_refs_sync: Don't crash on weird refs

tingping/wmclass
Alexander Larsson 2016-01-15 14:53:34 +01:00
parent cd2c5af974
commit a1b5bb1507
2 changed files with 8 additions and 3 deletions

View File

@ -1052,9 +1052,12 @@ xdg_app_installation_list_remote_refs_sync (XdgAppInstallation *self,
{ {
const char *refspec = key; const char *refspec = key;
const char *checksum = value; const char *checksum = value;
XdgAppRemoteRef *ref;
g_ptr_array_add (refs, ref = xdg_app_remote_ref_new (refspec, checksum, remote_name);
xdg_app_remote_ref_new (refspec, checksum, remote_name));
if (ref)
g_ptr_array_add (refs, ref);
} }
return g_steal_pointer (&refs); return g_steal_pointer (&refs);

View File

@ -137,7 +137,9 @@ xdg_app_remote_ref_new (const char *full_ref,
g_auto(GStrv) parts = NULL; g_auto(GStrv) parts = NULL;
XdgAppRemoteRef *ref; XdgAppRemoteRef *ref;
parts = g_strsplit (full_ref, "/", -1); parts = xdg_app_decompose_ref (full_ref, NULL);
if (parts == NULL)
return NULL;
if (strcmp (parts[0], "app") != 0) if (strcmp (parts[0], "app") != 0)
kind = XDG_APP_REF_KIND_RUNTIME; kind = XDG_APP_REF_KIND_RUNTIME;