-
Notifications
You must be signed in to change notification settings - Fork 67
[native_toolchain_c] check null instead of assert #2110
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
PR HealthBreaking changes ✔️
Changelog Entry ✔️
Changes to files need to be accounted for in their respective changelogs. API leaks ✔️The following packages contain symbols visible in the public API, but not exported by the library. Export these symbols or remove them from your publicly visible API.
License Headers ✔️
All source files should start with a license header. Unrelated files missing license headers
|
@@ -208,11 +208,12 @@ class InstallLocationResolver implements ToolResolver { | |||
Future<List<Uri>> tryResolvePath(String path) async { | |||
if (path.startsWith(home)) { |
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.
If it starts with $HOME
, and homeDir_
is null, shouldn't we simply return [];
early?
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.
I was wondering why this could ever be null anyway, it should not be.
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.
Do you still want to null check this? or should we close it? Maybe an env issue could still cause null here.
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.
Yeah it wouldn't hurt to check and return []
if there is no home. Then at least the code doesn't crash if the home path environment variable isn't set. 👍
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.
Cool, should be all set now.
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 your contributions @MichealReed ! 🙏
Given that there are multiple paths to resolve a tool, we should not assert if null, but instead avoid parsing the path if null.
Partially fixes #2109. NDK now resolves, other tools may still have errors.