mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-17 01:33:16 +03:00
beos: Avoid crashing if FindPath() returns an error
This can happen when running from the build directory, without the package already installed.
This commit is contained in:
parent
4497e9aab7
commit
dcf3a55ae6
@ -299,13 +299,13 @@ static char *find_resource(char *buf, const char *filename, const char *def)
|
|||||||
BPathFinder f((void*)find_resource);
|
BPathFinder f((void*)find_resource);
|
||||||
|
|
||||||
BPath p;
|
BPath p;
|
||||||
f.FindPath(B_FIND_PATH_APPS_DIRECTORY, "netsurf/res/", p);
|
if (f.FindPath(B_FIND_PATH_APPS_DIRECTORY, "netsurf/res", p) == B_OK) {
|
||||||
strcpy(t, p.Path());
|
strcpy(t, p.Path());
|
||||||
|
|
||||||
strcat(t, filename);
|
strcat(t, filename);
|
||||||
realpath(t, buf);
|
realpath(t, buf);
|
||||||
if (access(buf, R_OK) == 0)
|
if (access(buf, R_OK) == 0)
|
||||||
return buf;
|
return buf;
|
||||||
|
}
|
||||||
|
|
||||||
if (def[0] == '%') {
|
if (def[0] == '%') {
|
||||||
snprintf(t, PATH_MAX, "%s%s", path.Path(), def + 1);
|
snprintf(t, PATH_MAX, "%s%s", path.Path(), def + 1);
|
||||||
|
Loading…
Reference in New Issue
Block a user