How to reproduce:
1. Open the attached project "Repro_UITAuthoring"
2. Add "Assets/UITAuthoringRepro/CutPaste.uxml to the Hierarchy and open in in Context
3. Open the UI Viewport window
4. In the Hierarchy, select the "victim" Label and press Ctrl/Cmd+X
5. With "victim" still selected, press Delete
6. In the UI Viewport, select the "target" Button and press Ctrl/Cmd+V
7. Observe the Console
Expected results: Paste is disabled after the cut element has been deleted, and no error is thrown
Actual results: Paste stays enabled and "NullReferenceException" error is thrown
Reproducible with: 6000.7.0a6
Can't test with: 6000.3.17f1, 6000.5.10f1, 6000.6.0f1, 6000.7.0a5 (No such function)
Reproducible on: Ubuntu 24.04.4 LTS (x86_64), macOS Tahoe 26 (M1)
Not reproducible on: No other environment tested
First lines of error:
NullReferenceException: Object reference not set to an instance of an object
at Unity.UIToolkit.Editor.ReparentElementsCommand.Prepare (Unity.UIToolkit.Editor.PrepareContext& context) [0x0002e] in Modules/UIToolkitAuthoringEditor/Managed/Commands/ReparentElementsCommand.cs:71
at Unity.UIToolkit.Editor.CommandSystem.ExecuteCommandAndInvokeHandlers (Unity.UIToolkit.Editor.Command command) [0x0003e] in Modules/UIToolkitAuthoringEditor/Managed/Commands/CommandSystem.cs:314
at Unity.UIToolkit.Editor.UIViewport.DoPaste () [0x000db] in Modules/UIToolkitAuthoringEditor/Managed/Scene/UIViewport.cs:314