diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp
index 71716f5ba1cd929687504eea46fb94afcf144b92..8de17fdb3a22599650aa5455ea8479c7776c3ec7 100644
--- a/indra/llcommon/llerror.cpp
+++ b/indra/llcommon/llerror.cpp
@@ -1452,13 +1452,14 @@ namespace LLError
 			return;
 		}
 
-		if(strlen(out->str().c_str()) < 128)
+		auto out_str = out->str();
+		if(out_str.size() < 128)
 		{
-			strcpy(message, out->str().c_str());
+			strcpy(message, out_str.c_str());
 		}
 		else
 		{
-			strncpy(message, out->str().c_str(), 127);
+			strncpy(message, out_str.c_str(), 127);
 			message[127] = '\0' ;
 		}