Fix crash when opening the gallery - #3326
Merged
Merged
Conversation
ConvertOf is an x:Bind function binding over ViewModel.SelectedItem, and Bindings.Update runs from Load before an item has been selected, so the very first evaluation dereferenced a null GalleryMedia. ConvertCaption in the same file already guards its input the same way. Reported by crash telemetry on 12.9.0.0. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
FrayxRulez
added a commit
that referenced
this pull request
Aug 10, 2026
ConvertOf is an x:Bind function binding over ViewModel.SelectedItem, and Bindings.Update runs from Load before an item has been selected, so the very first evaluation dereferenced a null GalleryMedia. ConvertCaption in the same file already guards its input the same way. Reported by crash telemetry on 12.9.0.0. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
Crash
Reported by crash telemetry on 12.9.0.0.
Cause
ConvertOfis a function binding:and it dereferences its first argument straight away:
LoadcallsBindings.Update(), which evaluates every binding once, including this one —before
ViewModel.SelectedItemhas been assigned. The stack shows exactly that path, sothe first evaluation on open runs with a null item.
ConvertCaption, a few lines below in the same file, already guards its input(
string.IsNullOrEmpty(text?.Text)); this one was just missed.Fix
Return an empty string when there is no item yet. The binding re-evaluates as soon as
SelectedItemis set, so the label fills in normally.Verification
Not built or run — a UWP/.NET Native build is not available in the environment this was
prepared in. The edited file was checked with Roslyn (
CSharpSyntaxTree.ParseText) andparses with no syntax errors; that confirms syntax only, not type checking.
🤖 Generated with Claude Code