From 067468885a189bb26b465dbff2358de81cc6e392 Mon Sep 17 00:00:00 2001
From: Callum Prentice <callum@gmail.com>
Date: Thu, 15 Dec 2016 10:58:23 -0800
Subject: [PATCH] BUG-41027 (FIX) Changing login location at the login screen
 crashes the viewer

---
 indra/llrender/llrender.cpp | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp
index 0e242a20f69..98d3ab84358 100644
--- a/indra/llrender/llrender.cpp
+++ b/indra/llrender/llrender.cpp
@@ -2156,9 +2156,12 @@ void LLRender::vertexBatchPreTransformed(LLVector3* verts, LLVector2* uvs, LLCol
 		}
 	}
 
-	mVerticesp[mCount] = mVerticesp[mCount-1];
-	mTexcoordsp[mCount] = mTexcoordsp[mCount-1];
-	mColorsp[mCount] = mColorsp[mCount-1];
+	if (mCount > 0)
+	{
+		mVerticesp[mCount] = mVerticesp[mCount - 1];
+		mTexcoordsp[mCount] = mTexcoordsp[mCount - 1];
+		mColorsp[mCount] = mColorsp[mCount - 1];
+	}
 }
 
 void LLRender::vertex2i(const GLint& x, const GLint& y)
-- 
GitLab