[BUG]: Spawning SCP-079 without its default camera disconnects the player (TryGetDefaultCamera)
Before You Report
- [x] I have searched for existing reports of this bug, and this bug report is unique.
Version
1.1.6
Description
If you remove the base map (therefore default camera) then try to spawn SCP-079, it'll disconnect the player with a invalid data client error.
To Reproduce
Disable base game map spawning in configs Spawn the player as SCP-079
Expected Behavior
It should either :
- Spawn SCP-079 with a blank screen
- Try to get any other camera already spawned instead of disconnecting the player.
- Being able to set the default camera upon spawning a camera toy
Additional Information
Disconnecting connection: connection(0). This can happen if the other side accidentally (or an attacker intentionally) sent invalid data. Reason: System.NullReferenceException: Object reference not set to an instance of an object.
at PlayerRoles.PlayableScps.Scp079.Cameras.Scp079CurrentCameraSync+<>c.1[T] target, System.Func2[T,TResult] condition, T& first) [0x00000] in <00000000000000000000000000000000>:0
at PlayerRoles.PlayableScps.Scp079.Cameras.Scp079CurrentCameraSync.TryGetDefaultCamera (PlayerRoles.PlayableScps.Scp079.Cameras.Scp079Camera& cam) [0x00000] in <00000000000000000000000000000000>:0
at PlayerRoles.PlayableScps.Scp079.Cameras.Scp079CurrentCameraSync.TryGetCurrentCamera (PlayerRoles.PlayableScps.Scp079.Cameras.Scp079Camera& cam) [0x00000] in <00000000000000000000000000000000>:0
at PlayerRoles.PlayableScps.Scp079.Scp079SpeakerAbility.SpawnObject () [0x00000] in <00000000000000000000000000000000>:0
at GameObjectPools.PoolObject.SetupPoolObject () [0x00000] in <00000000000000000000000000000000>:0
at PlayerRoles.PlayerRoleManager.InitializeNewRole (PlayerRoles.RoleTypeId targetId, PlayerRoles.RoleChangeReason reason, PlayerRoles.RoleSpawnFlags spawnFlags, Mirror.NetworkReader data) [0x00000] in <00000000000000000000000000000000>:0
at PlayerRoles.RoleSyncInfo..ctor (Mirror.NetworkReader reader) [0x00000] in <00000000000000000000000000000000>:0
at PlayerRoles.PlayerRolesNetUtils.ReadRoleSyncInfo (Mirror.NetworkReader reader) [0x00000] in <00000000000000000000000000000000>:0
at Mirror.NetworkReader.Read[T] () [0x00000] in <00000000000000000000000000000000>:0
at Mirror.NetworkMessages+<>c__DisplayClass8_02[T,C].<WrapHandler>b__0 (Mirror.NetworkConnection conn, Mirror.NetworkReader reader, System.Int32 channelId) [0x00000] in <00000000000000000000000000000000>:0 at Mirror.NetworkClient.UnpackAndInvoke (Mirror.NetworkReader reader, System.Int32 channelId) [0x00000] in <00000000000000000000000000000000>:0 at Mirror.NetworkClient.OnTransportData (System.ArraySegment1[T] data, System.Int32 channelId) [0x00000] in <00000000000000000000000000000000>:0
at Mirror.LiteNetLib4Mirror.LiteNetLib4MirrorClient+<>c__DisplayClass9_0.2:<WrapHandler>b__0(NetworkConnection, NetworkReader, Int32) Mirror.NetworkClient:UnpackAndInvoke(NetworkReader, Int32) Mirror.NetworkClient:OnTransportData(ArraySegment1, Int32)
Mirror.LiteNetLib4Mirror.<>c__DisplayClass9_0:
The room can be null in this context (scp079Camera2.Room.Name == RoomName.Hcz079) resulting the NRE
Thanks for the report!
Also please check if the AllInstances (that is a camera) contains a Room property that is null!