Skip to content

Commit

Permalink
Fix No such element exception when moving an entity without any rules…
Browse files Browse the repository at this point in the history
… being active
  • Loading branch information
haukesomm committed Feb 6, 2024
1 parent e15fa9d commit 63167ff
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ class MoveServiceImpl(private vararg val moveRules: MoveRule) : MoveService {

val status = moveRules
.checkAll(state, position, direction)
.maxBy(MoveRuleResult::status)
.status
.maxByOrNull(MoveRuleResult::status)
.let { it?.status ?: MoveRuleResult.Status.Possible }

val newAccWithMoveAction = listOf(SimpleMoveAction(position, direction).let { action ->
if (entity.isBox) action.incrementPushes()
Expand Down

0 comments on commit 63167ff

Please sign in to comment.