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.column === 0 &&
|
||||||
end.line === start.line &&
|
end.line === start.line &&
|
||||||
end.side != start.side;
|
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.
|
// Selection ends at the beginning of the next line.
|
||||||
// Move the selection to the end of the previous line.
|
// Move the selection to the end of the previous line.
|
||||||
range.end = {
|
range.end = {
|
||||||
node: start.node,
|
node: start.node,
|
||||||
column: this._getLength(
|
column: lineLength,
|
||||||
domRange.cloneContents().querySelector('.contentText')),
|
|
||||||
side: start.side,
|
side: start.side,
|
||||||
line: start.line,
|
line: start.line,
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user