Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkgs/native_toolchain_c/lib/src/tool/tool_resolver.dart
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ class InstallLocationResolver implements ToolResolver {
Future<List<Uri>> tryResolvePath(String path) async {
if (path.startsWith(home)) {
Copy link
Collaborator

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?

Copy link
Collaborator

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.

#2112

Copy link
Contributor Author

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.

Copy link
Collaborator

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. 👍

Copy link
Contributor Author

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.

Copy link
Collaborator

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 ! 🙏

final homeDir_ = homeDir;
assert(homeDir_ != null);
if (homeDir_ == null) return [];
path = path.replaceAll(
'$home/',
homeDir!.toFilePath().replaceAll('\\', '/'),
Expand Down