fix: NullRefExceptions from inspectors (#789)

* fix: NullReferenceError while deleting a GameObject with parameter usage UI open

* fix: NullRefException from editor when moving a Menu Installer outside of an avatar
This commit is contained in:
bd_ 2024-03-16 20:50:41 +09:00 committed by GitHub
parent a630cfc316
commit f92d10cf50
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 2 deletions

View File

@ -178,7 +178,7 @@ namespace nadena.dev.modular_avatar.core.editor
}
}
if (InstallTargets.Count == 1 && (InstallTargets[0] is VRCExpressionsMenu || InstallTargets[0] == null))
if (commonAvatar != null && InstallTargets.Count == 1 && (InstallTargets[0] is VRCExpressionsMenu || InstallTargets[0] == null))
{
var displayValue = installTo.objectReferenceValue;
if (displayValue == null) displayValue = commonAvatar.expressionsMenu;

View File

@ -104,8 +104,10 @@ namespace nadena.dev.modular_avatar.core.editor
var ctx = serializedObject.context as GameObject;
if (ctx == null) return;
var avatarRoot = RuntimeUtil.FindAvatarTransformInParents(ctx.transform)?.gameObject;
if (ctx == null || avatarRoot == null) return;
if (avatarRoot == null) return;
var orderedPlugins = ParameterInfo.ForUI.GetParametersForObject(ctx)
.GroupBy(p => p.Plugin)