FIX: Only dispatch when there is a valid selected item#2383
Merged
josepmariapujol-unity merged 2 commits intodevelopfrom Mar 16, 2026
Merged
Conversation
Fixed a NullReferenceException when removing all action maps and improved messaging and validation in the Input System.
Codecov ReportAll modified and coverable lines are covered by tests ✅ @@ Coverage Diff @@
## develop #2383 +/- ##
=========================================
Coverage 77.90% 77.91%
=========================================
Files 476 482 +6
Lines 97613 97756 +143
=========================================
+ Hits 76048 76162 +114
- Misses 21565 21594 +29 Flags with carried forward coverage won't be shown. Click here to find out more.
|
MorganHoarau
approved these changes
Mar 16, 2026
Collaborator
MorganHoarau
left a comment
There was a problem hiding this comment.
Simple and effective fix. Ship it!
Darren-Kelly-Unity
approved these changes
Mar 16, 2026
ritamerkl
approved these changes
Mar 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR is fixing the
NullReferenceExceptionerror that triggers when removing all action mapsThe
selectedIndicesChangedcallback always accessed((ActionMapData)m_ListView.selectedItem).mapName. However, when the list view is refreshed (for example in RedrawUI whenitemsSourceis reassigned), the framework may triggerselectedIndicesChangedwhile no item is selected. In that situation,m_ListView.selectedItemis null, causing the cast and property access to throw aNullReferenceException.JIRA: https://jira.unity3d.com/browse/UUM-137116
Before:
https://github.com/user-attachments/assets/1fe91523-5b09-428e-9fa9-6e81bf1a60de
After:
https://github.com/user-attachments/assets/8e9be1f8-b2d1-4036-a440-23bfc23dfdbe
Testing status & QA
Check that no errors are thrown when removing all action maps.
Overall Product Risks
Please rate the potential complexity and halo effect from low to high for the reviewers. Note down potential risks to specific Editor branches if any.
Comments to reviewers
Please describe any additional information such as what to focus on, or historical info for the reviewers.
Checklist
Before review:
Changed,Fixed,Addedsections.Area_CanDoX,Area_CanDoX_EvenIfYIsTheCase,Area_WhenIDoX_AndYHappens_ThisIsTheResult.During merge:
NEW: ___.FIX: ___.DOCS: ___.CHANGE: ___.RELEASE: 1.1.0-preview.3.