diff --git a/src/main/java/com/baomidou/plugin/idea/mybatisx/service/KotlinService.java b/src/main/java/com/baomidou/plugin/idea/mybatisx/service/KotlinService.java index 22ef46985d03430ed4118c36abfc2439b267db9c..63b9e464dae48c31e3bb5a8bcdb1d1119875d68b 100644 --- a/src/main/java/com/baomidou/plugin/idea/mybatisx/service/KotlinService.java +++ b/src/main/java/com/baomidou/plugin/idea/mybatisx/service/KotlinService.java @@ -45,6 +45,9 @@ public class KotlinService { */ public void processKotlinMethod(@NotNull KtNamedFunction ktMethod, @NotNull Processor processor) { KtClass parentClass = PsiTreeUtil.getParentOfType(ktMethod, KtClass.class); + if (parentClass == null) { + return; + } if (!KtPsiUtil.isTrait(parentClass)) { return; }