From ea38fc2d8662f62e30344a3f9a8d71771ca8bb8a Mon Sep 17 00:00:00 2001 From: jacob1 Date: Wed, 23 Jan 2013 21:54:15 -0500 Subject: [PATCH] fix possible crash with LIGH --- src/simulation/elements/LIGH.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/simulation/elements/LIGH.cpp b/src/simulation/elements/LIGH.cpp index f697ebe2d..a6b77de02 100644 --- a/src/simulation/elements/LIGH.cpp +++ b/src/simulation/elements/LIGH.cpp @@ -296,7 +296,7 @@ bool Element_LIGH::create_LIGH(Simulation * sim, int x, int y, int c, int temp, sim->parts[p].tmp = tmp; sim->parts[p].tmp2 = tmp2; } - else + else if (x >= 0 && x < XRES && y >= 0 && y < YRES) { int r = sim->pmap[y][x]; if ((((r&0xFF)==PT_VOID || ((r&0xFF)==PT_PVOD && sim->parts[r>>8].life >= 10)) && (!sim->parts[r>>8].ctype || (sim->parts[r>>8].ctype==c)!=(sim->parts[r>>8].tmp&1))) || (r&0xFF)==PT_BHOL || (r&0xFF)==PT_NBHL) // VOID, PVOD, VACU, and BHOL eat LIGH here