-
Notifications
You must be signed in to change notification settings - Fork 459
Fix NullReferenceException thrown in PopupRenderer.SetViewController #1762
Conversation
… using in embedded forms scenario
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks to me, thanks for making the change so quickly. 🚀🚀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've a question
} | ||
else | ||
{ | ||
currentPageRenderer = Platform.GetRenderer(mainPage); | ||
ViewController ??= currentPageRenderer.ViewController; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we sure that we just want to set the ViewController if it's null?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
previously, we always set it. it was done by CreateControl. it was the only 1 place where we set it.
now we also set ViewController in ctor. we do not want to set it here again.
hope I correctly understand your question.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Vlad!
Let's remove the Null Forgiving Operator
src/CommunityToolkit/Xamarin.CommunityToolkit/Views/Popup/iOS/PopupRenderer.ios.cs
Outdated
Show resolved
Hide resolved
Null Forgiving Operator removed ✅
if (modalStackCount > 0) | ||
{ | ||
var index = modalStackCount - 1; | ||
page = page!.Navigation!.ModalStack![index]; | ||
page = page?.Navigation.ModalStack[index]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if ModalStack
is > 0 Page
will not be null
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rewrite it and add check page for null
Description of Bug
Issues Fixed
PR Checklist
approved