Skip to content

Commit

Permalink
[ark-app] fix: use more safe way of retrieving playersetupcallback fr…
Browse files Browse the repository at this point in the history
…om array
  • Loading branch information
didymental committed Apr 21, 2024
1 parent 535f2da commit b5aba96
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ArkKit/app/utils/set-up/ArkSetUpIfHostStrategy.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@ class ArkSetUpIfHostStrategy<View, ExternalResources: ArkExternalResources>: Ark

extension ArkSetUpIfHostStrategy: ArkPlayerStateSetupDelegate {
func setup(_ playerId: Int) {
let playerSetUpCallbacks = ark?.blueprint.playerSpecificSetupFunctions
guard let specificPlayerSetUp = playerSetUpCallbacks?[playerId],
guard let playerSetUpCallbacks = ark?.blueprint.playerSpecificSetupFunctions,
playerId < playerSetUpCallbacks.count,
let ark = ark else {
return
}
let specificPlayerSetUp = playerSetUpCallbacks[playerId]
ark.arkState.setup(specificPlayerSetUp, with: ark.setupContext)
}
}

0 comments on commit b5aba96

Please sign in to comment.