Skip to content

Commit a28ad39

Browse files
authored
Fix the isResolutionWorkspace exception in the new project action (#8443)
This resolves #8438 ahead of the 87.1 point release
1 parent 11cfb1e commit a28ad39

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/io/flutter/pub/PubRoot.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
*/
3333
public class PubRoot {
3434
public static final String DOT_DART_TOOL = ".dart_tool";
35+
public static final String PACKAGE_CONFIG_JSON = "package_config.json";
3536
public static final String DOT_PACKAGES = ".packages";
3637
public static final String PUBSPEC_YAML = "pubspec.yaml";
3738

@@ -288,14 +289,16 @@ public VirtualFile getPackageConfigFile() {
288289
// If this package.yaml file has resolution:workspace declared, check in the parent directory for
289290
// the .dart_tool/ directory.
290291
// https://github.com/flutter/flutter-intellij/issues/7623
291-
if (cachedPubspecInfo.isResolutionWorkspace()) {
292+
if (declaresResolutionWorkspace() && root.getParent() != null && root.getParent().isDirectory()) {
292293
rootToExpectToolsDirectory = root.getParent();
293294
}
295+
assert rootToExpectToolsDirectory != null;
296+
assert rootToExpectToolsDirectory.isDirectory();
294297
final VirtualFile tools = rootToExpectToolsDirectory.findChild(DOT_DART_TOOL);
295298
if (tools == null || !tools.isDirectory()) {
296299
return null;
297300
}
298-
final VirtualFile config = tools.findChild("package_config.json");
301+
final VirtualFile config = tools.findChild(PACKAGE_CONFIG_JSON);
299302
if (config != null && !config.isDirectory()) {
300303
return config;
301304
}

0 commit comments

Comments
 (0)