summaryrefslogtreecommitdiff
path: root/src/station_cmd.cpp
diff options
context:
space:
mode:
authorfonsinchen <fonsinchen@openttd.org>2013-10-23 19:04:06 +0000
committerfonsinchen <fonsinchen@openttd.org>2013-10-23 19:04:06 +0000
commitf528d2c59246cb76c5d84dfac04e84e1368ea650 (patch)
tree40eba275e45bb75a02c6b9ca026755f7707eb4b4 /src/station_cmd.cpp
parentb5dd83e84f355eedbfc78838c0961864cd7a8fb1 (diff)
downloadopenttd-f528d2c59246cb76c5d84dfac04e84e1368ea650.tar.xz
(svn r25910) -Fix: Guard against empty FlowStats in a few more places.
Diffstat (limited to 'src/station_cmd.cpp')
-rw-r--r--src/station_cmd.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp
index 423907a8f..ca0c0be05 100644
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -4228,6 +4228,7 @@ void FlowStat::ChangeShare(StationID st, int flow)
*/
void FlowStat::RestrictShare(StationID st)
{
+ assert(!this->shares.empty());
uint flow = 0;
uint last_share = 0;
SharesMap new_shares;
@@ -4248,6 +4249,7 @@ void FlowStat::RestrictShare(StationID st)
if (flow == 0) return;
new_shares[last_share + flow] = st;
this->shares.swap(new_shares);
+ assert(!this->shares.empty());
}
/**
@@ -4257,6 +4259,7 @@ void FlowStat::RestrictShare(StationID st)
*/
void FlowStat::ReleaseShare(StationID st)
{
+ assert(!this->shares.empty());
uint flow = 0;
uint next_share = 0;
bool found = false;
@@ -4283,6 +4286,7 @@ void FlowStat::ReleaseShare(StationID st)
}
}
this->shares.swap(new_shares);
+ assert(!this->shares.empty());
}
/**