button: save a few cycles by returning early

...and in preparation for the merge-config patch, avoid building
directory lists for empty filenames.
This commit is contained in:
Johan Malm 2024-01-17 21:50:53 +00:00 committed by Johan Malm
parent 4238d7fc33
commit d0aff49c81
3 changed files with 9 additions and 0 deletions

View file

@ -22,6 +22,9 @@ button_svg_load(const char *button_name, struct lab_data_buffer **buffer,
wlr_buffer_drop(&(*buffer)->base);
*buffer = NULL;
}
if (!button_name || !*button_name) {
return;
}
char filename[4096] = { 0 };
button_filename(button_name, filename, sizeof(filename));