diff options
| author | Ben Boeckel <MathStuf@gmail.com> | 2009-02-28 00:42:51 -0500 |
|---|---|---|
| committer | Ben Boeckel <MathStuf@gmail.com> | 2009-02-28 00:42:51 -0500 |
| commit | cd45e52962766099140320806e4e6ac5bb2f8383 (patch) | |
| tree | e6d738ba888a6c5d23dbb9aa05cbce695f63bf59 /sigmodr/widgets/MapWarpUI.cpp | |
| parent | 3655fc2210bcfaa02950754b57b52865b8d74071 (diff) | |
Protected combobox changes to avoid calls on error states
Diffstat (limited to 'sigmodr/widgets/MapWarpUI.cpp')
| -rw-r--r-- | sigmodr/widgets/MapWarpUI.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/sigmodr/widgets/MapWarpUI.cpp b/sigmodr/widgets/MapWarpUI.cpp index 4018fb5b..4dc9bb43 100644 --- a/sigmodr/widgets/MapWarpUI.cpp +++ b/sigmodr/widgets/MapWarpUI.cpp @@ -131,14 +131,18 @@ void MapWarpUI::typeChanged(const int type) void MapWarpUI::toMapChanged(const int toMap) { - qobject_cast<MapWarp*>(modified())->setToMap(game()->map(toMap)->id()); + if (0 <= toMap) + qobject_cast<MapWarp*>(modified())->setToMap(game()->map(toMap)->id()); } void MapWarpUI::toWarpChanged(const int toWarp) { - const Map* map = game()->map(qobject_cast<MapWarp*>(modified())->toMap()); - if (map) - qobject_cast<MapWarp*>(modified())->setToWarp(map->warp(toWarp)->id()); + if (0 <= toWarp) + { + const Map* map = game()->map(qobject_cast<MapWarp*>(modified())->toMap()); + if (map) + qobject_cast<MapWarp*>(modified())->setToWarp(map->warp(toWarp)->id()); + } } void MapWarpUI::scriptChanged(const Script& script) |
