mirror of
https://github.com/zyedidia/micro.git
synced 2026-02-05 14:40:20 +09:00
Do a bounds check for charpos function
This commit is contained in:
@@ -18,6 +18,9 @@ func FromCharPosStart(startLoc, startX, startY, loc int, buf *Buffer) (int, int)
|
||||
for charNum+lineLen <= loc {
|
||||
charNum += lineLen
|
||||
y++
|
||||
if y >= buf.NumLines {
|
||||
return 0, 0
|
||||
}
|
||||
lineLen = Count(buf.Lines[y]) + 1
|
||||
}
|
||||
x = loc - charNum
|
||||
|
||||
Reference in New Issue
Block a user