-
Notifications
You must be signed in to change notification settings - Fork 1.3k
fix null crash with mounted check #3802
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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.
Code Review
This pull request effectively resolves a null crash that occurred when displaying a firmware warning. The primary fix involves adding a mounted check before showing the dialog, which is a critical safeguard to prevent using the widget's context after it has been unmounted, especially in asynchronous operations. Additionally, the code quality is improved by using a distinct dialogContext within the dialog builder, which avoids variable shadowing and ensures the dialog is dismissed using the correct context. These changes make the code more robust and stable.
added #3802 (comment) |
@beastoin I added the line of code that actually causes the crash, which is |
|
pls resolve conflicts |
done |




omi/app/lib/pages/onboarding/find_device/found_devices.dart
Line 174 in 575d674
here dialog was called after async work, that's why State.context becomes null after the widget is disposed
closes #3801