[cache] Clear stash if called with called with NULL

This commit is contained in:
ejurgensen 2019-09-09 21:38:06 +02:00
parent 1752901529
commit 2e149273e5
1 changed files with 8 additions and 1 deletions

View File

@ -1218,7 +1218,7 @@ cache_artwork_stash_impl(void *arg, int *retval)
cmdarg = arg; cmdarg = arg;
/* Clear current stash */ // Clear current stash
if (g_stash.path) if (g_stash.path)
{ {
free(g_stash.path); free(g_stash.path);
@ -1226,6 +1226,13 @@ cache_artwork_stash_impl(void *arg, int *retval)
memset(&g_stash, 0, sizeof(struct stash)); memset(&g_stash, 0, sizeof(struct stash));
} }
// If called with no evbuf then we are done, we just needed to clear the stash
if (!cmdarg->evbuf)
{
*retval = 0;
return COMMAND_END;
}
g_stash.size = evbuffer_get_length(cmdarg->evbuf); g_stash.size = evbuffer_get_length(cmdarg->evbuf);
g_stash.data = malloc(g_stash.size); g_stash.data = malloc(g_stash.size);
if (!g_stash.data) if (!g_stash.data)