fix: prevent null crash in debugTogglePlatform when vmService is null#185812
Conversation
When running flutter run -d web-server, pressing the 'o' key to toggle platform caused a null check crash because vmService is null for web-server devices. Added a null guard that returns early with an informative message instead of crashing the tools process. Fixes flutter#185766
|
It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging. If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. If you believe this PR qualifies for a test exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group. |
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
There was a problem hiding this comment.
Code Review
This pull request adds a safety check in resident_runner.dart to prevent crashes when flutterDevices is empty or the vmService is null during a platform toggle. The review feedback identifies a redundant null-aware operator and requests the addition of a test case to verify the fix, as required by the repository's style guide.
bkonyi
left a comment
There was a problem hiding this comment.
Looks good to me overall, but we'll need to fix the analysis failures first before we can land.
|
Hi @bkonyi, I've addressed your feedback:
Latest changes have been pushed. Please let me know if anything else needs to be addressed. |
Co-authored-by: Navaron Bracke <brackenavaron@gmail.com>
|
autosubmit label was removed for flutter/flutter/185812, because - The status or check suite Linux analyzer_benchmark has failed. Please fix the issues identified (or deflake) before re-applying this label. |
…t.dart Co-authored-by: Navaron Bracke <brackenavaron@gmail.com>
e25356c
When running flutter run -d web-server, pressing the 'o' key to toggle platform caused a null check crash because vmService is null for web-server devices.
Added a null guard that returns early with an informative message instead of crashing the tools process.
Fixes #185766
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.
If this change needs to override an active code freeze, provide a comment explaining why. The code freeze workflow can be overridden by code reviewers. See pinned issues for any active code freezes with guidance.
Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the
gemini-code-assistbot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.