Don't crash on empty diff selection
Side-by-side diff doesn't contain .contentText which is used for triple click handling. Add a null guard to prevent run-time exception. Bug: Issue 5677 Change-Id: I76d49912af456e156c7cb7b0a31a810ff2b1ac97
This commit is contained in:
@@ -173,13 +173,14 @@
|
||||
end.column === 0 &&
|
||||
end.line === start.line &&
|
||||
end.side != start.side;
|
||||
if (endsOnOtherSideStart || endsAtOtherSideLineNum) {
|
||||
const content = domRange.cloneContents().querySelector('.contentText');
|
||||
const lineLength = content && this._getLength(content) || 0;
|
||||
if (lineLength && endsOnOtherSideStart || endsAtOtherSideLineNum) {
|
||||
// Selection ends at the beginning of the next line.
|
||||
// Move the selection to the end of the previous line.
|
||||
range.end = {
|
||||
node: start.node,
|
||||
column: this._getLength(
|
||||
domRange.cloneContents().querySelector('.contentText')),
|
||||
column: lineLength,
|
||||
side: start.side,
|
||||
line: start.line,
|
||||
};
|
||||
|
Reference in New Issue
Block a user