If-block rethink.
diff --git a/lib/cli_util.dart b/lib/cli_util.dart
index ac767b2..683bef7 100644
--- a/lib/cli_util.dart
+++ b/lib/cli_util.dart
@@ -37,18 +37,19 @@
// Try and locate the VM using 'which'.
String executable = whichSync('dart', orElse: () => null);
- if (executable == null) return null;
- // In case Dart is symlinked (e.g. homebrew on Mac) follow symbolic links.
- Link link = new Link(executable);
- if (link.existsSync()) {
- executable = link.resolveSymbolicLinksSync();
+ if (executable != null) {
+ // In case Dart is symlinked (e.g. homebrew on Mac) follow symbolic links.
+ Link link = new Link(executable);
+ if (link.existsSync()) {
+ executable = link.resolveSymbolicLinksSync();
+ }
+
+ File dartVm = new File(executable);
+ Directory dir = dartVm.parent.parent;
+ if (_isSdkDir(dir)) return dir;
}
- File dartVm = new File(executable);
- Directory dir = dartVm.parent.parent;
- if (_isSdkDir(dir)) return dir;
-
return null;
}