diff options
author | Alexander Larsson <alexl@redhat.com> | 2016-04-12 16:17:58 +0200 |
---|---|---|
committer | Alexander Larsson <alexl@redhat.com> | 2016-04-12 16:17:58 +0200 |
commit | ba0363bd2aa101eae2a1cab97692f92bb9f1d20e (patch) | |
tree | 2c28d6c32ca3744e6272ce545b8029cabaf02ec9 | |
parent | d52cb3b378ab0634a446175beb5e38c3d5c21cef (diff) | |
download | xdg-app-ba0363bd2aa101eae2a1cab97692f92bb9f1d20e.tar.gz |
Handle empty subpaths
-rw-r--r-- | common/xdg-app-dir.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/common/xdg-app-dir.c b/common/xdg-app-dir.c index 6cb2672..6f64cb9 100644 --- a/common/xdg-app-dir.c +++ b/common/xdg-app-dir.c @@ -585,9 +585,15 @@ xdg_app_dir_set_subpaths (XdgAppDir *self, return FALSE; } - data = g_strjoinv ("\n", (char **)subpaths); - file = g_file_get_child (deploy_base, "subpaths"); + + if (subpaths == NULL || subpaths[0] == NULL) + { + g_file_delete (file, cancellable, NULL); + return TRUE; + } + + data = g_strjoinv ("\n", (char **)subpaths); if (!g_file_replace_contents (file, data, strlen (data), NULL, FALSE, G_FILE_CREATE_NONE, NULL, cancellable, error)) return FALSE; |