From 86a62c8d80a53ac6dc3b8de86e2142f4cc5aa17e Mon Sep 17 00:00:00 2001 From: Ivandro Jao Date: Sat, 11 Apr 2026 22:36:37 +0100 Subject: [PATCH] Fix two bugs in NextWordInDoNotBreakList - Loop condition used || instead of &&, making i > 50 always true and causing out-of-bounds access - Loop body read text[index] (fixed position) instead of text[i], so the same character was checked every iteration Co-Authored-By: Claude Sonnet 4.6 --- src/libse/Common/PlainTextImporter.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libse/Common/PlainTextImporter.cs b/src/libse/Common/PlainTextImporter.cs index 299e0d7f7f4..a413e2c7f69 100644 --- a/src/libse/Common/PlainTextImporter.cs +++ b/src/libse/Common/PlainTextImporter.cs @@ -141,9 +141,9 @@ private bool CurrentWordInDoNotBreakList(string text, int index) private bool NextWordInDoNotBreakList(string text, int index) { - for (var i = index + 1; i < text.Length || i > 50; i++) + for (var i = index + 1; i < text.Length && i - index < 50; i++) { - var ch = text[index]; + var ch = text[i]; if (ch == '\0') { return false;