From cb709250779ee6e29d29cacff84e3980983dbd77 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Sun, 21 Sep 2014 19:24:45 +0100 Subject: Fix crash in cLineBlockTracer * Fixes #1418 --- src/LineBlockTracer.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/LineBlockTracer.cpp b/src/LineBlockTracer.cpp index f03e796d1..71b8334fa 100644 --- a/src/LineBlockTracer.cpp +++ b/src/LineBlockTracer.cpp @@ -227,9 +227,11 @@ bool cLineBlockTracer::Item(cChunk * a_Chunk) } // Update the current chunk - if (a_Chunk != NULL) + a_Chunk = a_Chunk->GetNeighborChunk(m_CurrentX, m_CurrentZ); + if (a_Chunk == NULL) { - a_Chunk = a_Chunk->GetNeighborChunk(m_CurrentX, m_CurrentZ); + m_Callbacks->OnNoChunk(); + return false; } if (a_Chunk->IsValid()) @@ -245,13 +247,10 @@ bool cLineBlockTracer::Item(cChunk * a_Chunk) return false; } } - else + else if (m_Callbacks->OnNextBlockNoData(m_CurrentX, m_CurrentY, m_CurrentZ, m_CurrentFace)) { - if (m_Callbacks->OnNextBlockNoData(m_CurrentX, m_CurrentY, m_CurrentZ, m_CurrentFace)) - { - // The callback terminated the trace - return false; - } + // The callback terminated the trace + return false; } } } -- cgit v1.2.3