From ed1ba6585a5fb98b55aea53dda5957040c7063fc Mon Sep 17 00:00:00 2001 From: scheffle Date: Wed, 30 Oct 2024 14:33:56 +0100 Subject: [PATCH] fix iterate may be advanced after string end --- vstgui/lib/ctexteditor.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vstgui/lib/ctexteditor.cpp b/vstgui/lib/ctexteditor.cpp index 5baadfe9d..e65c24c37 100644 --- a/vstgui/lib/ctexteditor.cpp +++ b/vstgui/lib/ctexteditor.cpp @@ -136,12 +136,12 @@ inline void replaceTabs (std::string& str, uint32_t tabWidth) //------------------------------------------------------------------------ inline void convertWinLineEndingsToUnixLineEndings (String& text) { - auto it = text.begin (), end = text.end (); - if (it == end) + auto it = text.begin (); + if (it == text.end ()) return; auto lastChar = it; ++it; - for (; it != end; ++it) + for (; it != text.end (); ++it) { if (*lastChar == '\r' && *it == '\n') {