summaryrefslogtreecommitdiff
path: root/beos
diff options
context:
space:
mode:
authorFran├žois Revol <revol@free.fr>2014-07-02 03:11:25 +0200
committerFran├žois Revol <revol@free.fr>2014-07-02 03:11:25 +0200
commitdcf3a55ae6083da252af43d7958981080e7e9e41 (patch)
tree5609a9b28c0cde43bc3626d9c082856ea3d19105 /beos
parent4497e9aab748a4e3f3615cafb7ef8f896ede660d (diff)
downloadnetsurf-dcf3a55ae6083da252af43d7958981080e7e9e41.tar.gz
netsurf-dcf3a55ae6083da252af43d7958981080e7e9e41.tar.bz2
beos: Avoid crashing if FindPath() returns an error
This can happen when running from the build directory, without the package already installed.
Diffstat (limited to 'beos')
-rw-r--r--beos/gui.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/beos/gui.cpp b/beos/gui.cpp
index f9e02d0de..19046a5e4 100644
--- a/beos/gui.cpp
+++ b/beos/gui.cpp
@@ -299,13 +299,13 @@ static char *find_resource(char *buf, const char *filename, const char *def)
BPathFinder f((void*)find_resource);
BPath p;
- f.FindPath(B_FIND_PATH_APPS_DIRECTORY, "netsurf/res/", p);
- strcpy(t, p.Path());
-
- strcat(t, filename);
- realpath(t, buf);
- if (access(buf, R_OK) == 0)
- return buf;
+ if (f.FindPath(B_FIND_PATH_APPS_DIRECTORY, "netsurf/res", p) == B_OK) {
+ strcpy(t, p.Path());
+ strcat(t, filename);
+ realpath(t, buf);
+ if (access(buf, R_OK) == 0)
+ return buf;
+ }
if (def[0] == '%') {
snprintf(t, PATH_MAX, "%s%s", path.Path(), def + 1);