From d2c3f41e1e2b762685cf29dd02d356ccc7663376 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Fri, 17 Jul 2015 12:08:09 +0200 Subject: [PATCH] Crash fix due to invalid calls to drawElements by Drake Arconis --- indra/llrender/llvertexbuffer.cpp | 8 ++++++++ indra/newview/llspatialpartition.cpp | 5 ++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp index 360a41e651..3bbd79d457 100755 --- a/indra/llrender/llvertexbuffer.cpp +++ b/indra/llrender/llvertexbuffer.cpp @@ -616,6 +616,14 @@ void LLVertexBuffer::drawElements(U32 mode, const LLVector4a* pos, const LLVecto { llassert(!LLGLSLShader::sNoFixedFunction || LLGLSLShader::sCurBoundShaderPtr != NULL); + // Crash fix due to invalid calls to drawElements by Drake Arconis + if (num_indices <= 0) + { + LL_WARNS() << "Called drawElements with 0 indices" << LL_ENDL; + return; + } + // + gGL.syncMatrices(); U32 mask = LLVertexBuffer::MAP_VERTEX; diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index f909305e1d..cfac7c04bf 100755 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -2514,7 +2514,10 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume) } } - if (phys_volume->mHullPoints) + // Crash fix due to invalid calls to drawElements by Drake Arconis + //if (phys_volume->mHullPoints) + if (phys_volume->mHullPoints && phys_volume->mHullIndices && phys_volume->mNumHullPoints > 0 && phys_volume->mNumHullIndices > 0) + // { //render hull