Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

[path_provider] Fix handling of null application ID #4606

Merged
merged 2 commits into from
Dec 10, 2021

Conversation

stuartmorgan-g
Copy link
Contributor

The lookup of application ID was handling null (Dart null), but not
nullptr (Dart representation of a C null pointer), so was throwing an
exception in applications without an application ID.

Refactors the FFI calls into a wrapper so that they can be faked for
unit testing.

This includes the shared_preferences_linux example application, so
this fixes tree breakage.

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the relevant style guides and ran the auto-formatter. (Unlike the flutter/flutter repo, the flutter/plugins repo does use dart format.)
  • I signed the CLA.
  • The title of the PR starts with the name of the plugin surrounded by square brackets, e.g. [shared_preferences]
  • I listed at least one issue that this PR fixes in the description above.
  • I updated pubspec.yaml with an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.
  • I updated CHANGELOG.md to add a description of the change, following repository CHANGELOG style.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

@flutter-dashboard
Copy link

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 Hixie on the #hackers channel in Chat.

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.

The lookup of application ID was handling `null` (Dart null), but not
`nullptr` (Dart representation of a C null pointer), so was throwing an
exception in applications without an application ID.

This includes the `shared_preferences_linux` example application, so
this fixes tree breakage.
@stuartmorgan-g
Copy link
Contributor Author

It looks like this pull request may not have tests.

I forgot to git add the test file; fixed.

@@ -2,7 +2,7 @@ name: path_provider_linux
description: Linux implementation of the path_provider plugin
repository: https://github.com/flutter/plugins/tree/master/packages/path_provider/path_provider_linux
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+path_provider%22
version: 2.1.3
version: 2.1.4
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I remember even for @VisibleForTesting API updates, we need to bump minor? (I might be wrong)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The file that I added the new content to shouldn't be exported. I just wanted to be extra-obvious about it being test-only.

Copy link
Contributor

@cyanglaz cyanglaz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@cyanglaz
Copy link
Contributor

Landing on red to fix tree

@cyanglaz cyanglaz merged commit e7dbb5f into flutter:master Dec 10, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Dec 10, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Dec 11, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Dec 11, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Dec 11, 2021
amantoux pushed a commit to amantoux/plugins that referenced this pull request Dec 11, 2021
The lookup of application ID was handling `null` (Dart null), but not
`nullptr` (Dart representation of a C null pointer), so was throwing an
exception in applications without an application ID.

This includes the `shared_preferences_linux` example application, so
this fixes tree breakage.
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Dec 13, 2021
KyleFin pushed a commit to KyleFin/plugins that referenced this pull request Dec 21, 2021
The lookup of application ID was handling `null` (Dart null), but not
`nullptr` (Dart representation of a C null pointer), so was throwing an
exception in applications without an application ID.

This includes the `shared_preferences_linux` example application, so
this fixes tree breakage.
@stuartmorgan-g stuartmorgan-g deleted the path-provider-linux-null-fix branch April 19, 2022 17:34
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants