diff options
-rw-r--r-- | gtk/filetype.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/gtk/filetype.c b/gtk/filetype.c index f5cf3bfe7..2ae59d867 100644 --- a/gtk/filetype.c +++ b/gtk/filetype.c @@ -157,7 +157,11 @@ const char *fetch_filetype(const char *unix_path) const char *type; int l; - stat(unix_path, &statbuf); + if (stat(unix_path, &statbuf) != 0) { + /* stat failed */ + return "text/plain"; + } + if (S_ISDIR(statbuf.st_mode)) return "application/x-netsurf-directory"; |