summaryrefslogtreecommitdiffstats
path: root/sigmodr/widgets/MapWarpUI.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'sigmodr/widgets/MapWarpUI.cpp')
-rw-r--r--sigmodr/widgets/MapWarpUI.cpp12
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)