8000 fix: KeyException when synced layer's base layer states are deleted by bdunderscore · Pull Request #626 · bdunderscore/ndmf · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix: KeyException when synced layer's base layer states are deleted #626

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 13, 2025

Conversation

bdunderscore
Copy link
Owner

@Copilot Copilot AI review requested due to automatic review settings May 13, 2025 01:51
Copy link
Contributor
@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Fixes a KeyException when synced layer overrides reference deleted base states by filtering out null keys and adding a test to ensure cloning still succeeds.

  • Added a unit test (DeletedSyncedLayerOverridesAreExcluded) to verify no exception is thrown when a synced layer's base state is deleted.
  • Updated VirtualLayer to exclude entries with missing (null) keys when building _syncedLayerMotionOverrides.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
UnitTests~/AnimationServices/VirtualLayerTest.cs Added test to confirm cloning after base state deletion does not throw
Editor/API/AnimatorServices/VirtualObjects/VirtualLayer.cs Filter out null keys in synced layer overrides dictionary creation
Comments suppressed due to low confidence (1)

UnitTests~/AnimationServices/VirtualLayerTest.cs:171

  • [nitpick] The test only checks that no exception is thrown but does not verify that overrides for the deleted state are actually excluded. Add an assertion (e.g., inspect the cloned controller’s overrides collection) to confirm the expected behavior.
context.Clone(committed);

@@ -142,7 +142,8 @@ private VirtualLayer(CloneContext context, AnimatorControllerLayer layer, int ph
_stateMachine = context.Clone(layer.stateMachine);

_syncedLayerMotionOverrides = SyncedLayerOverrideAccess.ExtractStateMotionPairs(layer)
?.ToImmutableDictionary(kvp => context.Clone(kvp.Key),
?.Where(kvp => kvp.Key).ToImmutableDictionary(
Copy link
Preview
Copilot AI May 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The predicate .Where(kvp => kvp.Key) is unclear and may not correctly filter out null states. Consider using kvp.Key != null (and potentially also kvp.Value != null) to explicitly exclude deleted base states.

Suggested change
?.Where(kvp => kvp.Key).ToImmutableDictionary(
?.Where(kvp => kvp.Key != null).ToImmutableDictionary(

Copilot uses AI. Check for mistakes.

@bdunderscore bdunderscore merged commit 1ac9a57 into main May 13, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[1.12.5]ビルド、再生ボタン(MAによる処理実行)押下時にVRCSDKPreprocessAvatarCallbackが出る
1 participant
0