fixed crash when the marched delimiter near cursor becomes rii large if lines are removed.

This commit is contained in:
paxcut
2026-03-19 12:15:22 -07:00
committed by paxcut
parent d454714428
commit f70268ea40

View File

@@ -646,6 +646,12 @@ namespace hex::ui {
bool TextEditor::MatchedDelimiter::setNearCursor(Lines *lines,const Coordinates &from) {
Coordinates fromCopy = from;
if (fromCopy.m_line >= lines->size())
return false;
if (m_nearCursor.m_line >= lines->size()) {
m_nearCursor = Invalid;
return false;
}
if (coordinatesNearDelimiter(lines, fromCopy)) {
m_nearCursor = fromCopy;
return true;
@@ -718,6 +724,8 @@ namespace hex::ui {
if (start == Invalid)
return false;
auto lineIndex = start.m_line;
if(lineIndex >= (i64) lines->size())
return false;
auto charIndex = lines->lineCoordsIndex(start);
auto direction1 = detectDirection(lines, start);
auto charCoords = lines->lineIndexCoords(lineIndex + 1, charIndex);