Skip to content

Commit 6cf49b3

Browse files
authored
Fix nullable direction combine (#8121)
* Allow Direction.combine to be nullable * requested changes
1 parent b114bfb commit 6cf49b3

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/main/java/ch/njol/skript/util/Direction.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,8 +357,18 @@ public static Direction deserialize(final String s) {
357357
}
358358
}
359359
}
360-
361-
public static Expression<Location> combine(final Expression<? extends Direction> dirs, final Expression<? extends Location> locs) {
360+
361+
/*
362+
* Combines direction and location expressions.
363+
* Useful for syntaxes to allow Skripters to have more control over their locations.
364+
* @param dirs The direction expressions to combine.
365+
* @param locs The location expressions to combine.
366+
* @return A combined expression or null if any of the inputs are null.
367+
*/
368+
public static @Nullable Expression<Location> combine(@Nullable Expression<? extends Direction> dirs, @Nullable Expression<? extends Location> locs) {
369+
if (dirs == null || locs == null)
370+
return null;
371+
362372
return new SimpleExpression<Location>() {
363373
@SuppressWarnings("null")
364374
@Override

0 commit comments

Comments
 (0)