From cd45e52962766099140320806e4e6ac5bb2f8383 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Sat, 28 Feb 2009 00:42:51 -0500 Subject: Protected combobox changes to avoid calls on error states --- sigmodr/widgets/MapWarpUI.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'sigmodr/widgets/MapWarpUI.cpp') 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(modified())->setToMap(game()->map(toMap)->id()); + if (0 <= toMap) + qobject_cast(modified())->setToMap(game()->map(toMap)->id()); } void MapWarpUI::toWarpChanged(const int toWarp) { - const Map* map = game()->map(qobject_cast(modified())->toMap()); - if (map) - qobject_cast(modified())->setToWarp(map->warp(toWarp)->id()); + if (0 <= toWarp) + { + const Map* map = game()->map(qobject_cast(modified())->toMap()); + if (map) + qobject_cast(modified())->setToWarp(map->warp(toWarp)->id()); + } } void MapWarpUI::scriptChanged(const Script& script) -- cgit