Skip to content

Commit 87b5f63

Browse files
committed
Fix NPE to enable deploy to root, fixes #1894648
1 parent 888731f commit 87b5f63

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

PluginsAndFeatures/azure-toolkit-for-intellij/src/main/java/com/microsoft/azure/toolkit/intellij/webapp/runner/webappconfig/slimui/WebAppDeployConfigurationPanel.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import com.microsoft.azure.toolkit.intellij.common.AzureFormPanel;
2323
import com.microsoft.azure.toolkit.lib.Azure;
2424
import com.microsoft.azure.toolkit.lib.appservice.AzureWebApp;
25+
import com.microsoft.azure.toolkit.lib.appservice.model.Runtime;
2526
import com.microsoft.azure.toolkit.lib.appservice.model.WebContainer;
2627
import com.microsoft.azure.toolkit.lib.appservice.service.IWebAppDeploymentSlot;
2728
import com.microsoft.azure.toolkit.lib.common.form.AzureFormInput;
@@ -147,10 +148,11 @@ private boolean isAbleToDeployToRoot(final AzureArtifact azureArtifact) {
147148
if (selectedWebApp == null || azureArtifact == null) {
148149
return false;
149150
}
150-
final WebContainer webContainer = selectedWebApp.getRuntime().getWebContainer();
151+
final String webContainer = Optional.ofNullable(selectedWebApp.getRuntime())
152+
.map(Runtime::getWebContainer).map(WebContainer::getValue).orElse(null);
151153
final String packaging = AzureArtifactManager.getInstance(project).getPackaging(azureArtifact);
152154
final boolean isDeployingWar = StringUtils.equalsAnyIgnoreCase(packaging, MavenConstants.TYPE_WAR, "ear");
153-
return isDeployingWar && StringUtils.containsAnyIgnoreCase(webContainer.getValue(), "tomcat", "jboss");
155+
return isDeployingWar && StringUtils.containsAnyIgnoreCase(webContainer, "tomcat", "jboss");
154156
}
155157

156158
private void toggleSlotPanel(boolean slot) {

0 commit comments

Comments
 (0)