flutter
flutter copied to clipboard
Catch exceptions when trying to decode state restoration saved datas
In packages/flutter/lib/src/services/restoration.dart's _decodeRestorationData
function, this function adds a try-catch block to catch any errors happening when calling StandardMessageCodec().decodeMessage()
. A FormatException can occur in StandardMessageCodec().decodeMessage()
if the data saved for state restoration is corrupted.
This fixes #147456.
Pre-launch Checklist
- [x] I read the Contributor Guide and followed the process outlined there for submitting PRs.
- [x] I read the Tree Hygiene wiki page, which explains my responsibilities.
- [x] I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
- [x] I signed the CLA.
- [x] I listed at least one issue that this PR fixes in the description above.
- [x] I updated/added relevant documentation (doc comments with
///
). - [x] I added new tests to check the change I am making, or this PR is test-exempt.
- [x] I followed the breaking change policy and added Data Driven Fixes where supported.
- [x] All existing and new tests are passing.
If you need help, consider asking for advice on the #hackers-new channel on Discord.
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact "@test-exemption-reviewer" in the #hackers channel in Chat (don't just cc them here, they won't see it! Use Discord!).
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.
Thanks for the contribution. Can you please add a test for this so we don't regress this in the future? Thank you!
This pull request executed golden file tests, but it has not been updated in a while (20+ days). Test results from Gold expire after as many days, so this pull request will need to be updated with a fresh commit in order to get results from Gold.
For more guidance, visit Writing a golden file test for package:flutter
.
Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.
(triage): @seelrd do you still have plans to come back to this to add a test and fix the check failures? Thank you!
I am going to close this since there was no follow up. Feel free to reopen, if you find the time to work on this again. Thank you.