summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-03-15 17:44:54 +0000
committerrubidium <rubidium@openttd.org>2010-03-15 17:44:54 +0000
commit4ba69b572de7a50b8caa61b5854700100ec61bd7 (patch)
tree950c4fd44acdb85a34eef6c1fc5d4d7820aaf35d /src
parentede670918af15abcd8b591d0947995b65dd347be (diff)
downloadopenttd-4ba69b572de7a50b8caa61b5854700100ec61bd7.tar.xz
(svn r19427) -Codechange: gracefully handle the case where we can't open a .tar file.
Diffstat (limited to 'src')
-rw-r--r--src/fileio.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/fileio.cpp b/src/fileio.cpp
index 1ae3c7e5e..b05e5a648 100644
--- a/src/fileio.cpp
+++ b/src/fileio.cpp
@@ -563,7 +563,11 @@ bool TarListAddFile(const char *filename)
if (it != _tar_list.end()) return false;
FILE *f = fopen(filename, "rb");
- assert(f != NULL);
+ /* Although the file has been found there can be
+ * a number of reasons we cannot open the file.
+ * Most common case is when we simply have not
+ * been given read access. */
+ if (f == NULL) return false;
const char *dupped_filename = strdup(filename);
_tar_list[filename].filename = dupped_filename;