Skip to content

Commit 99ae962

Browse files
use lineExists add 4 more locations
1 parent 95618eb commit 99ae962

File tree

1 file changed

+4
-4
lines changed
  • bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom

1 file changed

+4
-4
lines changed

bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/StyledText.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1087,15 +1087,15 @@ void calculateTopIndex(int delta) {
10871087
lineIndex++;
10881088
}
10891089
int lineHeight = 0;
1090-
if (lineIndex >= 0 && lineIndex < lineCount) {
1090+
if (lineExists(lineIndex)) {
10911091
lineHeight = renderer.getCachedLineHeight(lineIndex);
10921092
}
10931093
if (lineIndex < lineCount && -delta + lineHeight <= clientAreaHeight - topMargin - bottomMargin) {
10941094
topIndex = lineIndex;
10951095
topIndexY = -delta;
10961096
} else {
10971097
topIndex = lineIndex - 1;
1098-
if (topIndex >= 0 && topIndex < lineCount) {
1098+
if (lineExists(topIndex)) {
10991099
topIndexY = -renderer.getCachedLineHeight(topIndex);
11001100
}
11011101
topIndexY -= delta;
@@ -1106,15 +1106,15 @@ void calculateTopIndex(int delta) {
11061106
while (lineIndex > 0) {
11071107
int previousLineIndex = lineIndex - 1;
11081108
int lineHeight = 0;
1109-
if (previousLineIndex >= 0 && previousLineIndex < lineCount) {
1109+
if (lineExists(previousLineIndex)) {
11101110
lineHeight = renderer.getCachedLineHeight(previousLineIndex);
11111111
}
11121112
if (delta + lineHeight > 0) break;
11131113
delta += lineHeight;
11141114
lineIndex--;
11151115
}
11161116
int lineHeight = 0;
1117-
if (lineIndex >= 0 && lineIndex < lineCount) {
1117+
if (lineExists(lineIndex)) {
11181118
lineHeight = renderer.getCachedLineHeight(lineIndex);
11191119
}
11201120
if (lineIndex == 0 || -delta + lineHeight <= clientAreaHeight - topMargin - bottomMargin) {

0 commit comments

Comments
 (0)