summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/dungeon.cc
diff options
context:
space:
mode:
Diffstat (limited to 'crawl-ref/source/dungeon.cc')
-rw-r--r--crawl-ref/source/dungeon.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/crawl-ref/source/dungeon.cc b/crawl-ref/source/dungeon.cc
index b1acc696be..ab10abb259 100644
--- a/crawl-ref/source/dungeon.cc
+++ b/crawl-ref/source/dungeon.cc
@@ -3172,8 +3172,9 @@ static void _place_traps(int level_number)
// Choose again!
ts.type = random_trap_for_place(level_number);
- // If we get shaft a second time, turn it into an alarm trap.
- if (ts.type == TRAP_SHAFT)
+ // If we get shaft a second time, turn it into an alarm trap, or
+ // if we got nothing.
+ if (ts.type == TRAP_SHAFT || ts.type>= NUM_TRAPS)
ts.type = TRAP_ALARM;
}
}