Skip to content

Commit

Permalink
fix Redundant null check
Browse files Browse the repository at this point in the history
"The variable item cannot be null at this location"
  • Loading branch information
EcljpseB0T authored and jukzi committed Jan 26, 2024
1 parent d842285 commit b95c6e5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -259,18 +259,16 @@ public void dragOver(DropTargetEvent event) {
*/
@Override
protected int determineLocation(DropTargetEvent event) {
if (!(event.item instanceof Item item)) {
return LOCATION_NONE;
}
Point coordinates = new Point(event.x, event.y);
coordinates = getViewer().getControl().toControl(coordinates);
if (item != null) {
if (event.item instanceof Item item) {
Point coordinates = new Point(event.x, event.y);
coordinates = getViewer().getControl().toControl(coordinates);
Rectangle bounds = getBounds(item);
if (bounds == null) {
return LOCATION_NONE;
}
return LOCATION_ON;
}
return LOCATION_ON;
return LOCATION_NONE;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,18 +218,16 @@ public void dragOver(DropTargetEvent event) {
*/
@Override
protected int determineLocation(DropTargetEvent event) {
if (!(event.item instanceof Item item)) {
return LOCATION_NONE;
}
Point coordinates = new Point(event.x, event.y);
coordinates = getViewer().getControl().toControl(coordinates);
if (item != null) {
if (event.item instanceof Item item) {
Point coordinates = new Point(event.x, event.y);
coordinates = getViewer().getControl().toControl(coordinates);
Rectangle bounds = getBounds(item);
if (bounds == null) {
return LOCATION_NONE;
}
return LOCATION_ON;
}
return LOCATION_ON;
return LOCATION_NONE;
}

@Override
Expand Down

0 comments on commit b95c6e5

Please sign in to comment.