diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp
index 1c19a33c4edfee94763a4932be4db9c321bc59aa..1cc3cc04d61ca5f2449b24358109049baf4fd3f3 100644
--- a/indra/llui/lltextbase.cpp
+++ b/indra/llui/lltextbase.cpp
@@ -1164,7 +1164,7 @@ void LLTextBase::reflow()
 	S32 first_line = getFirstVisibleLine();
 
 	// if scroll anchor not on first line, update it to first character of first line
-	if (!mLineInfoList.empty()
+	if ((first_line < mLineInfoList.size())
 		&&	(mScrollIndex <  mLineInfoList[first_line].mDocIndexStart
 			||	mScrollIndex >= mLineInfoList[first_line].mDocIndexEnd))
 	{