Skip to content

Commit 8367ffb

Browse files
authored
Gracefully handle perf tool window not being created (#7713)
A workaround for #7691, not accessing the tool window if it wasn't created due to `isApplicableAsync` being false for the SDK version. Does it in this listener so if the SDK version changes, the event still can be handled properly.
1 parent 2df6372 commit 8367ffb

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

flutter-idea/src/io/flutter/performance/FlutterPerformanceViewFactory.java

+5-2
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,11 @@ public static void init(@NotNull Project project) {
4040
private static void initPerfView(@NotNull Project project, FlutterViewMessages.FlutterDebugEvent event) {
4141
ApplicationManager.getApplication().invokeLater(() -> {
4242
final FlutterPerformanceView flutterPerfView = project.getService(FlutterPerformanceView.class);
43-
ToolWindowManager.getInstance(project).getToolWindow(FlutterPerformanceView.TOOL_WINDOW_ID).setAvailable(true);
44-
flutterPerfView.debugActive(event);
43+
final ToolWindow window = ToolWindowManager.getInstance(project).getToolWindow(FlutterPerformanceView.TOOL_WINDOW_ID);
44+
if (flutterPerfView != null && window != null) {
45+
window.setAvailable(true);
46+
flutterPerfView.debugActive(event);
47+
}
4548
});
4649
}
4750

0 commit comments

Comments
 (0)