Skip to content

Commit 16bbf75

Browse files
committed
Add error handling when get function methods, fixes #6813
1 parent 672e3c2 commit 16bbf75

File tree

1 file changed

+9
-5
lines changed
  • PluginsAndFeatures/azure-toolkit-for-intellij/azure-intellij-plugin-appservice/src/main/java/com/microsoft/azure/toolkit/intellij/legacy/function/runner

1 file changed

+9
-5
lines changed

PluginsAndFeatures/azure-toolkit-for-intellij/azure-intellij-plugin-appservice/src/main/java/com/microsoft/azure/toolkit/intellij/legacy/function/runner/FunctionRunConfigurationProducer.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,17 @@ public boolean isConfigurationFromContext(AzureRunConfigurationBase appConfigura
101101
}
102102

103103
private static Location<PsiMethod> getAzureFunctionMethods(final Location<?> location) {
104-
for (Iterator<Location<PsiMethod>> iterator = location.getAncestors(PsiMethod.class, false); iterator.hasNext();) {
105-
final Location<PsiMethod> methodLocation = iterator.next();
106-
if (FunctionUtils.isFunctionClassAnnotated(methodLocation.getPsiElement())) {
107-
return methodLocation;
104+
try {
105+
for (Iterator<Location<PsiMethod>> iterator = location.getAncestors(PsiMethod.class, false); iterator.hasNext(); ) {
106+
final Location<PsiMethod> methodLocation = iterator.next();
107+
if (FunctionUtils.isFunctionClassAnnotated(methodLocation.getPsiElement())) {
108+
return methodLocation;
109+
}
108110
}
111+
return null;
112+
} catch (Throwable e) {
113+
return null;
109114
}
110-
return null;
111115
}
112116

113117
private Module findModule(FunctionRunConfiguration configuration, Module contextModule) {

0 commit comments

Comments
 (0)