cli: Fix crash when using .include with an empty directory

This would previously fail the size > 0 assertion in pa_xmalloc.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/454>
This commit is contained in:
Patrick Gaskin 2021-01-03 03:29:35 -05:00 committed by PulseAudio Marge Bot
parent c2ae56a73c
commit b1bdd27a6c

View file

@ -2118,8 +2118,7 @@ int pa_cli_command_execute_line_stateful(pa_core *c, const char *s, pa_strbuf *b
}
closedir(d);
count = pa_dynarray_size(files);
if ((count = pa_dynarray_size(files))) {
sorted_files = pa_xnew(char*, count);
for (i = 0; i < count; ++i)
sorted_files[i] = pa_dynarray_get(files, i);
@ -2147,6 +2146,7 @@ int pa_cli_command_execute_line_stateful(pa_core *c, const char *s, pa_strbuf *b
if (failed)
return -1;
}
}
} else if (pa_cli_command_execute_file(c, filename, buf, fail) < 0 && *fail) {
return -1;
}