Skip to content

Commit

Permalink
Fix possible NPE in function run configuration producer (#4583)
Browse files Browse the repository at this point in the history
* Fix possible NPE in function run configuration producer

* Fix checkstyle
  • Loading branch information
Flanker32 authored Sep 7, 2020
1 parent 173fdd7 commit b35ed4c
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,17 @@ public ConfigurationFactory getConfigurationFactory() {
}

@Override
protected boolean setupConfigurationFromContext(AzureRunConfigurationBase configuration, ConfigurationContext context, Ref ref) {
if (!(configuration instanceof FunctionRunConfiguration || configuration instanceof FunctionDeployConfiguration)) {
protected boolean setupConfigurationFromContext(AzureRunConfigurationBase runConfigurationBase, ConfigurationContext context, Ref ref) {
if (!(runConfigurationBase instanceof FunctionRunConfiguration || runConfigurationBase instanceof FunctionDeployConfiguration)) {
return false;
}

final Location contextLocation = context.getLocation();
assert contextLocation != null;
Location<PsiMethod> methodLocation = getAzureFunctionMethods(contextLocation);
if (methodLocation == null) {
return false;
}
AzureRunConfigurationBase configuration = runConfigurationBase;
if (configuration instanceof FunctionDeployConfiguration) {
final RunManagerEx manager = RunManagerEx.getInstanceEx(context.getProject());
// since deploy configuration doesn't support, we need to create a FunctionRunConfiguration
Expand All @@ -85,6 +85,8 @@ protected boolean setupConfigurationFromContext(AzureRunConfigurationBase config
final Module module = findModule(runConfiguration, contextModule);
if (module != null) {
runConfiguration.initializeDefaults(module);
} else {
return false;
}
}
if (StringUtils.isBlank(configuration.getName())) {
Expand Down

0 comments on commit b35ed4c

Please sign in to comment.