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.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/newgrf_config.cpp b/src/newgrf_config.cpp
index bbd670a71..df8685030 100644
--- a/src/newgrf_config.cpp
+++ b/src/newgrf_config.cpp
@@ -360,10 +360,10 @@ static bool CalcGRFMD5Sum(GRFConfig *config, Subdirectory subdir)
f = FioFOpenFile(config->filename, "rb", subdir, &size);
if (f == NULL) return false;
- size_t start = ftell(f);
+ long start = ftell(f);
size = min(size, GRFGetSizeOfDataSection(f));
- if (fseek(f, start, SEEK_SET) < 0) {
+ if (start < 0 || fseek(f, start, SEEK_SET) < 0) {
FioFCloseFile(f);
return false;
}