From aca20e85fb698c56ababbeb60c949699bcfeb798 Mon Sep 17 00:00:00 2001 From: Nicky Date: Sat, 21 Jul 2012 14:18:10 +0200 Subject: [PATCH] Crashfix; Change llassert_always to llassert + llwarns. This way users don't get disruptive crashes. --- indra/llrender/llvertexbuffer.cpp | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp index 87c33a9df1..305d2abbf5 100644 --- a/indra/llrender/llvertexbuffer.cpp +++ b/indra/llrender/llvertexbuffer.cpp @@ -534,8 +534,28 @@ void LLVertexBuffer::drawArrays(U32 mode, const std::vector& pos, con gGL.syncMatrices(); U32 count = pos.size(); - llassert_always(norm.size() >= pos.size()); - llassert_always(count > 0); + + // Don't crash, but just warn and exit out. This should be safe to do and won't disrupt the user with a crash + + // llassert_always(norm.size() >= pos.size()); + // llassert_always(count > 0); + + llassert(norm.size() >= pos.size()); + llassert(count > 0); + + if( count == 0 ) + { + llwarns << "Called drawArrays with 0 vertices" << llendl; + return; + } + + if( norm.size() < pos.size() ) + { + llwarns << "Called drawArrays with #" << norm.size() << " normals and #" << pos.size() << " vertices" << llendl; + return; + } + + // unbind();