diff --git a/lexilla/lexers_x/LexDart.cxx b/lexilla/lexers_x/LexDart.cxx index 0a008ebed..dd5d49931 100644 --- a/lexilla/lexers_x/LexDart.cxx +++ b/lexilla/lexers_x/LexDart.cxx @@ -409,7 +409,7 @@ void SCI_METHOD LexerDart::Lex(Sci_PositionU startPos, Sci_Position length, int } else { //?const int chNext = GetNextNSChar(); - while (IsASpace(sc.ch)){ sc.Forward(); }; + while (IsASpace(sc.ch) && sc.More()){ sc.Forward(); }; if (sc.ch == '(') { sc.ChangeState(SCE_DART_FUNCTION); } diff --git a/lexilla/lexers_x/LexKotlin.cxx b/lexilla/lexers_x/LexKotlin.cxx index 9e2575650..bc05a8363 100644 --- a/lexilla/lexers_x/LexKotlin.cxx +++ b/lexilla/lexers_x/LexKotlin.cxx @@ -418,7 +418,7 @@ void SCI_METHOD LexerKotlin::Lex(Sci_PositionU startPos, Sci_Position length, in if (kwType != SCE_KOTLIN_DEFAULT) { //?const int chNext = sc.GetNextNSChar(); - while (IsASpace(sc.ch)) { sc.Forward(); }; + while (IsASpace(sc.ch) && sc.More()) { sc.Forward(); }; if (!((kwType == SCE_KOTLIN_LABEL && sc.ch == '@') || (kwType != SCE_KOTLIN_LABEL && IsIdentifierStart(sc.ch)))) { kwType = SCE_KOTLIN_DEFAULT; @@ -450,7 +450,7 @@ void SCI_METHOD LexerKotlin::Lex(Sci_PositionU startPos, Sci_Position length, in } else { - while (IsASpace(sc.ch)) { sc.Forward(); }; + while (IsASpace(sc.ch) && sc.More()) { sc.Forward(); }; if (sc.ch == '(') { sc.ChangeState(SCE_KOTLIN_FUNCTION); }