From 9194438fb552dc2f112535e2420d94de7af40e17 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Wed, 16 Jul 2014 22:21:00 +0100 Subject: Fixed another redstone simulator crash --- src/Simulator/IncrementalRedstoneSimulator.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Simulator/IncrementalRedstoneSimulator.cpp b/src/Simulator/IncrementalRedstoneSimulator.cpp index fb5b01e17..55c5cbd09 100644 --- a/src/Simulator/IncrementalRedstoneSimulator.cpp +++ b/src/Simulator/IncrementalRedstoneSimulator.cpp @@ -2101,6 +2101,13 @@ bool cIncrementalRedstoneSimulator::QueueRepeaterPowerChange(int a_RelBlockX, in void cIncrementalRedstoneSimulator::SetSourceUnpowered(int a_SourceX, int a_SourceY, int a_SourceZ, cChunk * a_Chunk, bool a_IsFirstCall) { + if (!a_IsFirstCall) // The neighbouring chunks passed when this parameter is false may be invalid + { + if ((a_Chunk == NULL) || !a_Chunk->IsValid()) + { + return; + } + } // TODO: on C++11 support, change both of these to llama functions pased to a std::remove_if for (PoweredBlocksList::iterator itr = a_Chunk->GetRedstoneSimulatorPoweredBlocksList()->begin(); itr != a_Chunk->GetRedstoneSimulatorPoweredBlocksList()->end();) -- cgit v1.2.3