Skip to content

Commit fa3752f

Browse files
project view may be null on opening project.
1 parent 961a146 commit fa3752f

File tree

1 file changed

+3
-5
lines changed
  • PluginsAndFeatures/azure-toolkit-for-intellij/azure-intellij-resource-connector-lib/src/main/java/com/microsoft/azure/toolkit/intellij/facet

1 file changed

+3
-5
lines changed

PluginsAndFeatures/azure-toolkit-for-intellij/azure-intellij-resource-connector-lib/src/main/java/com/microsoft/azure/toolkit/intellij/facet/AzureFacet.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,12 @@ public static void addTo(@Nonnull final Module module) {
4242
return;
4343
}
4444
final AzureFacet facet = getInstance(module);
45-
final PropertiesComponent properties = PropertiesComponent.getInstance(module.getProject());
46-
final String key = getFacetFlag(module);
4745
if (Objects.isNull(facet)) {
46+
final PropertiesComponent properties = PropertiesComponent.getInstance(module.getProject());
4847
FacetManager.getInstance(module).addFacet(AzureFacetType.INSTANCE, "Azure", null);
49-
properties.setValue(key, true);
50-
ProjectView.getInstance(module.getProject()).getCurrentProjectViewPane().updateFromRoot(true);
48+
properties.setValue(getFacetFlag(module), true);
49+
Optional.ofNullable(ProjectView.getInstance(module.getProject())).ifPresent(v -> v.getCurrentProjectViewPane().updateFromRoot(true));
5150
}
52-
ProjectView.getInstance(module.getProject()).getCurrentProjectViewPane().updateFromRoot(true);
5351
}
5452

5553
public static boolean wasEverAddedTo(@Nonnull final Module module) {

0 commit comments

Comments
 (0)