From 3eaf8bee6d9a5ba257718d13e7186f4dd4dd6f37 Mon Sep 17 00:00:00 2001 From: Rinna Koharu <70315656+Rerigferl@users.noreply.github.com> Date: Sat, 14 Sep 2024 10:54:20 +0900 Subject: [PATCH] fix: Add null checks to ScaleAdjusterPreview (#1116) * fix: Add null checks to ScaleAdjusterPreview * chore: check for destroyed objects as well --------- Co-authored-by: bd_ --- Editor/ScaleAdjuster/ScaleAdjusterPreview.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Editor/ScaleAdjuster/ScaleAdjusterPreview.cs b/Editor/ScaleAdjuster/ScaleAdjusterPreview.cs index 58ebfd90..31f3beb6 100644 --- a/Editor/ScaleAdjuster/ScaleAdjusterPreview.cs +++ b/Editor/ScaleAdjuster/ScaleAdjusterPreview.cs @@ -328,7 +328,7 @@ namespace nadena.dev.modular_avatar.core.editor var rootBone = _finalBonesMap.TryGetValue(smr.rootBone, out var newRootBone) ? newRootBone : smr.rootBone; smr.rootBone = rootBone; - smr.bones = smr.bones.Select(b => _finalBonesMap.GetValueOrDefault(b, b)).ToArray(); + smr.bones = smr.bones.Select(b => b == null ? null : _finalBonesMap.GetValueOrDefault(b, b)).ToArray(); } public void Dispose() @@ -341,4 +341,4 @@ namespace nadena.dev.modular_avatar.core.editor _boneStates.Dispose(); } } -} \ No newline at end of file +}