Skip to content

fix: add null check for oldNode in GameEditorChangePropagator#2851

Merged
tebjan merged 1 commit into
stride3d:masterfrom
laske185:feature/2850-fix-old-value-at-change-propagator
Jul 30, 2025
Merged

fix: add null check for oldNode in GameEditorChangePropagator#2851
tebjan merged 1 commit into
stride3d:masterfrom
laske185:feature/2850-fix-old-value-at-change-propagator

Conversation

@laske185

Copy link
Copy Markdown
Contributor

PR Details

Added a null check for oldNode before invoking visitor.Visit(oldNode).
This change prevents potential null reference exceptions during execution.

The bug was introduced in the "User-defined assets support" feature in 5da9ae3 and is not in the release version.

Related Issue

Closes #2850

Types of changes

  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My change requires a change to the documentation.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • I have built and run the editor to try this change out.

- Added a null check for `oldNode` before invoking `visitor.Visit(oldNode)`.
- This change prevents potential null reference exceptions during execution.
Copilot AI review requested due to automatic review settings July 26, 2025 13:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes a potential null reference exception in the GameEditorChangePropagator by adding a null check before calling visitor.Visit(oldNode). The fix addresses a bug introduced in the "User-defined assets support" feature that could cause crashes during game editor operations.

  • Added null check for oldNode parameter before visitor invocation
  • Prevents null reference exceptions in the change propagation logic
Comments suppressed due to low confidence (1)

@tebjan

tebjan commented Jul 30, 2025

Copy link
Copy Markdown
Member

Looks good, thanks for the detailed description!

@tebjan tebjan merged commit 2ba62dc into stride3d:master Jul 30, 2025
4 checks passed
@Eideren

Eideren commented Jul 30, 2025

Copy link
Copy Markdown
Collaborator

That part was authored by xen afair so I'm not 100% certain what this change entails, do either of you know why oldNode may be null when its value is not ? Not super likely but this could just be caused by another issue upstream and this change is just silencing it further.

If it is safe, shouldn't line 195 to 203 be included inside the if as well ?

@laske185

laske185 commented Jul 30, 2025

Copy link
Copy Markdown
Contributor Author

In Line 193 the oldNode is returned by the Editor.NodeContainer for the OldValue from the change event. This value was in my cases, the old row or column of the UI element in the grid. For these values, the NodeContainers do not have any IObjectNode.

var oldNode = Editor.NodeContainer.GetNode(e.OldValue);

Maybe you are right, and it is safer when the complete code is inside the if statement.

@laske185 laske185 deleted the feature/2850-fix-old-value-at-change-propagator branch August 4, 2025 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Component property changes in a UI page are not updated in the view

5 participants