Skip to content

Commit

Permalink
Avoid reading lineView.rest when it is null in mapFromLineView
Browse files Browse the repository at this point in the history
  • Loading branch information
marijnh committed Oct 22, 2021
1 parent 67bb88e commit 367b5e7
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/measurement/position_measurement.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,14 @@ function ensureLineHeights(cm, lineView, rect) {
export function mapFromLineView(lineView, line, lineN) {
if (lineView.line == line)
return {map: lineView.measure.map, cache: lineView.measure.cache}
for (let i = 0; i < lineView.rest.length; i++)
if (lineView.rest[i] == line)
return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]}
for (let i = 0; i < lineView.rest.length; i++)
if (lineNo(lineView.rest[i]) > lineN)
return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i], before: true}
if (lineView.rest) {
for (let i = 0; i < lineView.rest.length; i++)
if (lineView.rest[i] == line)
return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]}
for (let i = 0; i < lineView.rest.length; i++)
if (lineNo(lineView.rest[i]) > lineN)
return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i], before: true}
}
}

// Render a line into the hidden node display.externalMeasured. Used
Expand Down

0 comments on commit 367b5e7

Please sign in to comment.