reject empty xresources (#340)

currently, in case of an empty xresources we would fail to init:

	nsxiv: Error allocating color ''

instead, just reject empty value and use the fallback.

Closes: https://codeberg.org/nsxiv/nsxiv/issues/339

Reviewed-on: https://codeberg.org/nsxiv/nsxiv/pulls/340
Reviewed-by: Berke Kocaoğlu <berke.kocaoglu@metu.edu.tr>
Co-authored-by: NRK <nrk@disroot.org>
Co-committed-by: NRK <nrk@disroot.org>
This commit is contained in:
NRK 2022-07-05 11:24:53 +02:00 committed by Berke Kocaoğlu
parent 51d4c8dd4f
commit 5cab2fb525

View file

@ -95,7 +95,7 @@ static const char* win_res(XrmDatabase db, const char *name, const char *def)
if (db != NULL && if (db != NULL &&
XrmGetResource(db, name, name, &type, &ret) && XrmGetResource(db, name, name, &type, &ret) &&
STREQ(type, "String")) STREQ(type, "String") && *ret.addr != '\0')
{ {
return ret.addr; return ret.addr;
} else { } else {