summaryrefslogtreecommitdiff
path: root/src/station_cmd.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2013-02-17 20:16:49 +0000
committerrubidium <rubidium@openttd.org>2013-02-17 20:16:49 +0000
commitbae033c23dea6d3f97f66f26e3e6f2ebc48b8d34 (patch)
treeb9c6d4bf523f1b834a791864c68322e424954dce /src/station_cmd.cpp
parent20668eeb733005856f5c9cad64ddbb843420e40a (diff)
downloadopenttd-bae033c23dea6d3f97f66f26e3e6f2ebc48b8d34.tar.xz
(svn r25016) -Fix [FS#5476]: integer overflow in UpdateStationRating (fonsinchen)
Diffstat (limited to 'src/station_cmd.cpp')
-rw-r--r--src/station_cmd.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp
index 128528672..b2f6ba3aa 100644
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -3307,7 +3307,9 @@ static void UpdateStationRating(Station *st)
waiting_changed = true;
}
- if (waiting_changed) ge->cargo.Truncate(ge->cargo.Count() - waiting);
+ if (waiting_changed && waiting < ge->cargo.Count()) {
+ ge->cargo.Truncate(ge->cargo.Count() - waiting);
+ }
}
}
}