Skip to content

Commit 9b192e7

Browse files
authored
allMatch is weird on empty list
1 parent fb2de0f commit 9b192e7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

api/src/main/java/me/tofaa/entitylib/ve/ViewerEngine.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ public void clearTracked() {
121121
* @return true if the user passed and did not fail any rules, false otherwise
122122
*/
123123
public boolean canSpawnFor(User user, WrapperEntity entity) {
124-
if (entity.getViewerRules().stream().allMatch(rule -> rule.shouldSee(user))) return true;
124+
if (!entity.getViewerRules().isEmpty() && entity.getViewerRules().stream().allMatch(rule -> rule.shouldSee(user))) return true;
125125
return globalRules.stream().allMatch(rule -> rule.shouldSee(user));
126126
}
127127

0 commit comments

Comments
 (0)