From 6f05249fdc8ab2ec196e78cdf8bb06697531bfd4 Mon Sep 17 00:00:00 2001 From: fgenesis Date: Tue, 9 Oct 2012 00:57:34 +0200 Subject: [PATCH] Fix crash in RenderObjectLayer::moveToBack() --- BBGE/RenderObjectLayer.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/BBGE/RenderObjectLayer.cpp b/BBGE/RenderObjectLayer.cpp index 6e37049..cd63ae8 100644 --- a/BBGE/RenderObjectLayer.cpp +++ b/BBGE/RenderObjectLayer.cpp @@ -314,7 +314,8 @@ void RenderObjectLayer::moveToBack(RenderObject *r) for (int i = newSize - 1; i >= sizeDiff; i--) { renderObjects[i] = renderObjects[i - sizeDiff]; - renderObjects[i]->setIdx(i); // Known to be non-NULL. + if(renderObjects[i]) + renderObjects[i]->setIdx(i); } for (int i = 0; i < newIdx; i++) renderObjects[i] = 0;