summaryrefslogtreecommitdiff
path: root/src/newgrf_config.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/newgrf_config.cpp')
-rw-r--r--src/newgrf_config.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/newgrf_config.cpp b/src/newgrf_config.cpp
index 5ac8ba4df..bbd670a71 100644
--- a/src/newgrf_config.cpp
+++ b/src/newgrf_config.cpp
@@ -362,7 +362,11 @@ static bool CalcGRFMD5Sum(GRFConfig *config, Subdirectory subdir)
size_t start = ftell(f);
size = min(size, GRFGetSizeOfDataSection(f));
- fseek(f, start, SEEK_SET);
+
+ if (fseek(f, start, SEEK_SET) < 0) {
+ FioFCloseFile(f);
+ return false;
+ }
/* calculate md5sum */
while ((len = fread(buffer, 1, (size > sizeof(buffer)) ? sizeof(buffer) : size, f)) != 0 && size != 0) {