-
Notifications
You must be signed in to change notification settings - Fork 3.3k
[google_sign_in_web] Fixes force unwrap on values that can be null #4374
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
[google_sign_in_web] Fixes force unwrap on values that can be null #4374
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.
Thanks for the contribution! LGTM other than the version.
@ditman for secondary review.
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 for noticing this, and following the whole contribution procedure!
LGTM!
const String minimalJwtToken = | ||
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.$minimalPayload.UTAe7dpdtFIMwsOqkZkjyjqyHnho5xHCcQylUFmOutM'; |
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 for adding a test!
I'm glad you managed to create one of these, it's not a trivial process!
displayName: payload['name']! as String, | ||
photoUrl: payload['picture']! as String, | ||
displayName: payload['name'] as String?, | ||
photoUrl: payload['picture'] as String?, |
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 makes total sense. Even the documentation of GoogleSignInUserData
has the following comment on top of displayName
and photoUrl
:
/// Not guaranteed to be present for all users, even when configured.
flutter/packages@7042079...771ec9b 2023-07-06 [email protected] [ci] Enable LUCI Dart unit tests (flutter/packages#4378) 2023-07-06 [email protected] [ci] Bring up LUCI Linux custom package tests (flutter/packages#4382) 2023-07-06 [email protected] [pigeon] adds generate option for example pigeons (flutter/packages#4370) 2023-07-06 [email protected] [go_router] Allows redirect only GoRoute to be part of RouteMatchList (flutter/packages#4315) 2023-07-06 49699333+dependabot[bot]@users.noreply.github.com [sign_in]: Bump com.google.android.gms:play-services-auth from 20.5.0 to 20.6.0 in /packages/google_sign_in/google_sign_in_android/android (flutter/packages#4359) 2023-07-06 [email protected] [pigeon]fix a crash when casting NSNull to an Array (flutter/packages#4289) 2023-07-06 [email protected] [google_sign_in_web] Fixes force unwrap on values that can be null (flutter/packages#4374) 2023-07-05 [email protected] Roll Flutter from 590ef2d to 35085c3 (3 revisions) (flutter/packages#4379) 2023-07-05 [email protected] [camerax] Fixes `unawaited_futures` violations (flutter/packages#4337) 2023-07-05 [email protected] [ci] Remove `starqlteue` from FTL tests (flutter/packages#4375) 2023-07-05 [email protected] [tools] Switch to `flutter test` (flutter/packages#4348) 2023-07-05 [email protected] [flutter_markdown] Add TableCellVerticalAlignment property in markdown stylesheet (flutter/packages#3880) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC [email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
During Google Sign-in, the code uses two force unwraps on values (name and picture) that can be not present in the response. This cause an unhandled error that blocks sign-in.
Fixes flutter/flutter#130002 reported by me. The bug report describes how to get that error together with a screenshot of a given line.
My PR fixes that and add additional test for the future.
Pre-launch Checklist
dart format
.)[shared_preferences]
pubspec.yaml
with an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.CHANGELOG.md
to add a description of the change, following repository CHANGELOG style.///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.