fix: potential null reference exceptions from ProxyManager (#750)

* chore: fix incorrect namespace

* fix: potential null reference exceptions from ProxyManager
This commit is contained in:
bd_ 2024-03-09 01:08:38 -08:00 committed by GitHub
parent 01d24f6809
commit 17e6c22335
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 7 deletions

View File

@ -3,13 +3,12 @@
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using nadena.dev.modular_avatar.JacksonDunstan.NativeCollections;
using UnityEngine;
using UnityEngine.SceneManagement;
#if UNITY_EDITOR
using UnityEditor;
using UnityEditor.SceneManagement;
#endif
using UnityEngine;
using UnityEngine.SceneManagement;
#endregion
@ -90,7 +89,7 @@ namespace nadena.dev.modular_avatar.core
internal static ImmutableDictionary<SkinnedMeshRenderer, SkinnedMeshRenderer> OriginalToProxyRenderer =>
_originalToReplacementRenderer;
internal static ImmutableHashSet<GameObject> RetainedObjects;
internal static ImmutableHashSet<GameObject> RetainedObjects = ImmutableHashSet<GameObject>.Empty;
internal static bool ShouldRetain(GameObject obj) => RetainedObjects.Contains(obj);
@ -220,7 +219,7 @@ namespace nadena.dev.modular_avatar.core
for (var i = 0; i < weights.Length; i++)
{
var bone = bones[weights[i].boneIndex];
if (_capturedBones.ContainsKey(bone)) return true;
if (bone != null && _capturedBones.ContainsKey(bone)) return true;
}
return false;

View File

@ -1,7 +1,11 @@
using System.Collections.Generic;
#region
using System.Collections.Generic;
using System.Runtime.CompilerServices;
namespace nadena.dev.modular_avatar.JacksonDunstan.NativeCollections
#endregion
namespace nadena.dev.modular_avatar
{
internal class ObjectIdentityComparer<T> : IEqualityComparer<T>
{