From 89f3bf6c13c07038c1d50ea0babb35045cba7f77 Mon Sep 17 00:00:00 2001
From: Andrey Kleshchev <andreykproductengine@lindenlab.com>
Date: Tue, 17 Jan 2023 22:06:22 +0200
Subject: [PATCH] SL-18985 Crash at std::basic_string::erase

---
 indra/llwindow/llwindowwin32.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp
index 6039aa66184..11a3c943ee2 100644
--- a/indra/llwindow/llwindowwin32.cpp
+++ b/indra/llwindow/llwindowwin32.cpp
@@ -4438,7 +4438,7 @@ BOOL LLWindowWin32::handleImeRequests(WPARAM request, LPARAM param, LRESULT *res
 				LLWString context = find_context(wtext, preedit, preedit_length, &context_offset);
 				preedit -= context_offset;
 				preedit_length = llmin(preedit_length, (S32)context.length() - preedit);
-				if (preedit_length && preedit >= 0)
+				if (preedit_length > 0 && preedit >= 0)
 				{
 					// IMR_DOCUMENTFEED may be called when we have an active preedit.
 					// We should pass the context string *excluding* the preedit string.
-- 
GitLab