mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-04 02:47:22 +00:00
add null checks to all uses of OrbTransformSyncs
This commit is contained in:
parent
d59b0b2ea5
commit
18dc5bfbde
@ -69,7 +69,7 @@ namespace QSB.OrbSync.Events
|
||||
DebugLog.ToConsole("Error - FromPlayer is null!", MessageType.Error);
|
||||
}
|
||||
|
||||
var orbSync = NomaiOrbTransformSync.OrbTransformSyncs
|
||||
var orbSync = NomaiOrbTransformSync.OrbTransformSyncs.Where(x => x != null)
|
||||
.FirstOrDefault(x => x.AttachedObject == QSBWorldSync.OldOrbList[message.ObjectId].transform);
|
||||
if (orbSync == null)
|
||||
{
|
||||
@ -115,13 +115,13 @@ namespace QSB.OrbSync.Events
|
||||
return;
|
||||
}
|
||||
|
||||
if (!NomaiOrbTransformSync.OrbTransformSyncs.Any(x => x.AttachedObject == QSBWorldSync.OldOrbList[message.ObjectId].transform))
|
||||
if (!NomaiOrbTransformSync.OrbTransformSyncs.Where(x => x != null).Any(x => x.AttachedObject == QSBWorldSync.OldOrbList[message.ObjectId].transform))
|
||||
{
|
||||
DebugLog.ToConsole($"Error - No NomaiOrbTransformSync has AttachedOrb with objectId {message.ObjectId}!");
|
||||
return;
|
||||
}
|
||||
|
||||
var orb = NomaiOrbTransformSync.OrbTransformSyncs
|
||||
var orb = NomaiOrbTransformSync.OrbTransformSyncs.Where(x => x != null)
|
||||
.First(x => x.AttachedObject == QSBWorldSync.OldOrbList[message.ObjectId].transform);
|
||||
orb.enabled = true;
|
||||
}
|
||||
|
@ -165,7 +165,7 @@ namespace QSB.WorldSync
|
||||
return;
|
||||
}
|
||||
|
||||
var orbSync = NomaiOrbTransformSync.OrbTransformSyncs.FirstOrDefault(x => x.AttachedObject == affectingOrb.transform);
|
||||
var orbSync = NomaiOrbTransformSync.OrbTransformSyncs.Where(x => x != null).FirstOrDefault(x => x.AttachedObject == affectingOrb.transform);
|
||||
if (orbSync == null)
|
||||
{
|
||||
DebugLog.ToConsole($"Error - No NomaiOrbTransformSync found for {affectingOrb.name} (For slot {slot.name})!", MessageType.Error);
|
||||
|
Loading…
Reference in New Issue
Block a user