Skip to content

Commit

Permalink
Fix NPE in TierSortingStruct
Browse files Browse the repository at this point in the history
Signed-off-by: TheSilkMiner <thesilkminer@outlook.com>
  • Loading branch information
TheSilkMiner committed Aug 1, 2022
1 parent 2f609e0 commit afd8245
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import org.openzen.zencode.java.ZenCodeType;

import java.util.Objects;
import java.util.Optional;
import java.util.function.Supplier;
import java.util.stream.Stream;

Expand Down Expand Up @@ -72,6 +73,9 @@ static TierSortingStruct of(final TierReference tier) {
}

public Supplier<Object> get() {
return () -> Stream.of(this.rl, this.name, this.tier.get()).filter(Objects::nonNull).findFirst().orElseGet(Object::new);
return () -> Stream.of(this.rl, this.name, Optional.ofNullable(this.tier).map(TierReference::get).orElse(null))
.filter(Objects::nonNull)
.findFirst()
.orElseGet(Object::new);
}
}

0 comments on commit afd8245

Please sign in to comment.