Skip to content

Commit 4957057

Browse files
authored
Nits in PubRoot.java and PubRootCache.java (flutter#7548)
Follow up on this recent commit: flutter@a8d3f98
1 parent a8d3f98 commit 4957057

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

flutter-idea/src/io/flutter/pub/PubRoot.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ public static PubRoot forDirectory(@Nullable VirtualFile dir) {
153153
*/
154154
@Nullable
155155
public static PubRoot forDirectoryWithRefresh(@NotNull VirtualFile dir) {
156-
// Ensure file existence and timestamps are up to date.
156+
// Ensure file existence and timestamps are up-to-date.
157157
dir.refresh(false, false);
158158

159159
return forDirectory(dir);
@@ -342,11 +342,10 @@ public VirtualFile getFileToOpen() {
342342
if (main != null) {
343343
return main;
344344
}
345-
346345
final VirtualFile lib = getLib();
347346
if (lib != null) {
348347
final VirtualFile[] files = lib.getChildren();
349-
if (files.length != 0) {
348+
if (files != null && files.length != 0) {
350349
return files[0];
351350
}
352351
}
@@ -365,6 +364,7 @@ public VirtualFile getLibMain() {
365364
/**
366365
* Returns example/lib/main.dart if it exists.
367366
*/
367+
@Nullable
368368
public VirtualFile getExampleLibMain() {
369369
final VirtualFile exampleDir = root.findChild("example");
370370
if (exampleDir != null) {

flutter-idea/src/io/flutter/pub/PubRootCache.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public List<PubRoot> getRoots(@NotNull Project project) {
9090
}
9191

9292
@Nullable
93-
private VirtualFile findPubspecDir(VirtualFile file) {
93+
private VirtualFile findPubspecDir(@Nullable VirtualFile file) {
9494
if (file == null) {
9595
return null;
9696
}

0 commit comments

Comments
 (0)