Skip to content

Commit

Permalink
Fix null pointer exception in ExprBlocks when using the ExprDirection…
Browse files Browse the repository at this point in the history
… without a number defined. (#5790)

Update ExprBlocks.java

(cherry picked from commit 549ebc3)
  • Loading branch information
TheLimeGlass committed Jul 6, 2023
1 parent 8ccadc7 commit a0b8f71
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/main/java/ch/njol/skript/expressions/ExprBlocks.java
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,11 @@ public Iterator<Block> iterator(Event event) {
int distance = SkriptConfig.maxTargetBlockDistance.value();
if (this.direction instanceof ExprDirection) {
Expression<Number> numberExpression = ((ExprDirection) this.direction).amount;
Number number = numberExpression.getSingle(event);
if (numberExpression != null && number != null)
distance = number.intValue();
if (numberExpression != null) {
Number number = numberExpression.getSingle(event);
if (number != null)
distance = number.intValue();
}
}
return new BlockLineIterator(location, vector, distance);
} else {
Expand Down

0 comments on commit a0b8f71

Please sign in to comment.