Skip to content

Commit

Permalink
guard against disposed when querying project type (flutter#3081)
Browse files Browse the repository at this point in the history
  • Loading branch information
devoncarew authored Jan 14, 2019
1 parent a82b13c commit 7207674
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/io/flutter/utils/FlutterModuleUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,11 @@
*/
package io.flutter.utils;

import static io.flutter.sdk.FlutterSdk.DART_SDK_SUFFIX;

import com.intellij.execution.RunManager;
import com.intellij.execution.RunnerAndConfigurationSettings;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.fileEditor.FileEditorManager;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleManager;
import com.intellij.openapi.module.ModuleType;
import com.intellij.openapi.module.ModuleTypeManager;
import com.intellij.openapi.module.ModuleUtilCore;
import com.intellij.openapi.module.*;
import com.intellij.openapi.project.DumbService;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.project.ProjectManager;
Expand All @@ -35,10 +29,13 @@
import io.flutter.run.SdkRunConfig;
import io.flutter.sdk.FlutterSdk;
import io.flutter.sdk.FlutterSdkUtil;
import java.util.List;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.List;

import static io.flutter.sdk.FlutterSdk.DART_SDK_SUFFIX;

public class FlutterModuleUtils {
public static final String DEPRECATED_FLUTTER_MODULE_TYPE_ID = "WEB_MODULE";

Expand Down Expand Up @@ -179,6 +176,9 @@ public static Module[] getModules(@NotNull Project project) {
* Check if any module in this project {@link #declaresFlutter(Module)}.
*/
public static boolean declaresFlutter(@NotNull Project project) {
if (project.isDisposed()) {
return false;
}
return CollectionUtils.anyMatch(getModules(project), FlutterModuleUtils::declaresFlutter);
}

Expand Down

0 comments on commit 7207674

Please sign in to comment.