From bc6070bd197159dd81750d1e2e8af493864be818 Mon Sep 17 00:00:00 2001
From: Graham Madarasz <graham@lindenlab.com>
Date: Wed, 5 Jun 2013 07:38:54 -0700
Subject: MAINT-2740 more comment grooming and NULL string guard

---
 indra/llcommon/llerror.cpp | 13 +++++++++----
 indra/llcommon/llerror.h   |  2 +-
 2 files changed, 10 insertions(+), 5 deletions(-)

(limited to 'indra')

diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp
index 37ba097832..d2af004cde 100755
--- a/indra/llcommon/llerror.cpp
+++ b/indra/llcommon/llerror.cpp
@@ -1402,15 +1402,20 @@ namespace LLError
 #if LL_WINDOWS
 	void LLOutputDebugUTF8(const std::string& s)
 	{
-		// Be careful not to enable this in non-debug builds as there are bad interactions between the
-		// exceptions thrown by this function and the handling of stacks in coroutine fibers. BUG-2707
+		// Be careful when calling OutputDebugString as it throws DBG_PRINTEXCEPTION_C 
+		// which works just fine under the windows debugger, but can cause users who
+		// have enabled SEHOP exception chain validation to crash due to interactions
+		// between the Win 32-bit exception handling and boost coroutine fiber stacks. BUG-2707
 		//
 		if (IsDebuggerPresent())
 		{
 			// Need UTF16 for Unicode OutputDebugString
 			//
-			OutputDebugString(utf8str_to_utf16str(s).c_str());
-			OutputDebugString(TEXT("\n"));
+			if (s.size())
+			{
+				OutputDebugString(utf8str_to_utf16str(s).c_str());
+				OutputDebugString(TEXT("\n"));
+			}
 		}
 	}
 #endif
diff --git a/indra/llcommon/llerror.h b/indra/llcommon/llerror.h
index cc9bfba818..0b723aeb5d 100755
--- a/indra/llcommon/llerror.h
+++ b/indra/llcommon/llerror.h
@@ -206,7 +206,7 @@ namespace LLError
 }
 
 #if LL_WINDOWS
-	// Macro accepting a const std::string& for display in windows debugging console in debug builds only
+	// Macro accepting a std::string for display in windows debugging console
 	#define LL_WINDOWS_OUTPUT_DEBUG(a) LLError::LLOutputDebugUTF8(a)
 #else
 	#define LL_WINDOWS_OUTPUT_DEBUG(a)
-- 
cgit v1.2.3