mirror of
https://github.com/bdunderscore/modular-avatar.git
synced 2025-01-30 18:22:52 +08:00
fix: potential null ref exceptions from scale adjuster (#767)
This commit is contained in:
parent
a801f0ee76
commit
3f50da35f2
@ -54,6 +54,12 @@ namespace nadena.dev.modular_avatar.core
|
||||
|
||||
internal void PreCull()
|
||||
{
|
||||
if (this == null)
|
||||
{
|
||||
EditorApplication.delayCall += () => ProxyManager.UnregisterAdjuster(this);
|
||||
return;
|
||||
}
|
||||
|
||||
if (PrefabUtility.IsPartOfPrefabAsset(this)) return;
|
||||
|
||||
if (scaleProxyChild == null || initialized == false)
|
||||
|
@ -102,9 +102,13 @@ namespace nadena.dev.modular_avatar.core
|
||||
// Give each adjuster a chance to initialize the bone mappings first
|
||||
foreach (var adj in _capturedAdjusters)
|
||||
{
|
||||
if (adj == null)
|
||||
{
|
||||
_capturedAdjusters = _adjusters = _adjusters.Remove(adj);
|
||||
}
|
||||
adj.PreCull();
|
||||
}
|
||||
|
||||
|
||||
foreach (var kvp in _originalToReplacementBone)
|
||||
{
|
||||
if (kvp.Key == null || kvp.Value == null)
|
||||
@ -255,6 +259,10 @@ namespace nadena.dev.modular_avatar.core
|
||||
|
||||
foreach (var adj in _capturedAdjusters)
|
||||
{
|
||||
if (adj == null)
|
||||
{
|
||||
_capturedAdjusters = _capturedAdjusters.Remove(adj);
|
||||
}
|
||||
adj.PreCull(); // update scale
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user