diff --git a/ArkKit/app/utils/set-up/ArkSetUpIfHostStrategy.swift b/ArkKit/app/utils/set-up/ArkSetUpIfHostStrategy.swift index ae6693b..4c54961 100644 --- a/ArkKit/app/utils/set-up/ArkSetUpIfHostStrategy.swift +++ b/ArkKit/app/utils/set-up/ArkSetUpIfHostStrategy.swift @@ -24,11 +24,12 @@ class ArkSetUpIfHostStrategy: 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) } }