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
  • Loading branch information
TheLimeGlass authored Jul 6, 2023
1 parent 011c91e commit 549ebc3
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 549ebc3

Please sign in to comment.