Skip to content

Commit

Permalink
Log error when getPosition() returns a bad offset
Browse files Browse the repository at this point in the history
Work for vrapper#657.
  • Loading branch information
albertdev committed Jun 26, 2015
1 parent 58c1b6c commit a2e80be
Showing 1 changed file with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,14 @@ public void widgetSelected(final SelectionEvent arg0) {
if ( ! selectionInProgress) {
selection = null;
// getPosition() compensates for inclusive visual selection's caret offset.
updateStickyColumn(getPosition().getViewOffset());
Position position = getPosition();
int viewOffset = position.getViewOffset();
if (viewOffset >= 0) {
updateStickyColumn(viewOffset);
} else {
VrapperLog.error("Cannot update stick column: caret is at position M"
+ position.getModelOffset() + " but" + " viewoffset is -1!");
}
}
}

Expand All @@ -436,7 +443,14 @@ public void selectionChanged(SelectionChangedEvent event) {
if ( ! selectionInProgress) {
selection = null;
// getPosition() compensates for inclusive visual selection's caret offset.
updateStickyColumn(getPosition().getViewOffset());
Position position = getPosition();
int viewOffset = position.getViewOffset();
if (viewOffset >= 0) {
updateStickyColumn(viewOffset);
} else {
VrapperLog.error("Cannot update stick column: caret is at position M"
+ position.getModelOffset() + " but" + " viewoffset is -1!");
}
}
}
}
Expand Down

0 comments on commit a2e80be

Please sign in to comment.