From 5f93c43efb1668b1e146f444901e9d72644e4bdc Mon Sep 17 00:00:00 2001 From: UltraDev Date: Tue, 4 Oct 2022 13:51:19 +0200 Subject: [PATCH] fix: sourceplusplus/sourceplusplus#720 --- .../jetbrains/marker/js/detect/endpoint/ExpressEndpoint.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/marker/js-marker/src/main/kotlin/spp/jetbrains/marker/js/detect/endpoint/ExpressEndpoint.kt b/marker/js-marker/src/main/kotlin/spp/jetbrains/marker/js/detect/endpoint/ExpressEndpoint.kt index ccb816a41..73cb97c7d 100644 --- a/marker/js-marker/src/main/kotlin/spp/jetbrains/marker/js/detect/endpoint/ExpressEndpoint.kt +++ b/marker/js-marker/src/main/kotlin/spp/jetbrains/marker/js/detect/endpoint/ExpressEndpoint.kt @@ -57,7 +57,10 @@ class ExpressEndpoint : EndpointDetector.EndpointNameDeterminer { return@runReadAction } val router = method.firstChild as JSReferenceExpression - val routerVariable = router.resolve() as JSVariable? ?: return@runReadAction + val routerVariable = router.resolve() as JSInitializerOwner? ?: run { + promise.complete(Optional.empty()) + return@runReadAction + } if (method.children.size < 3) { promise.complete(Optional.empty()) @@ -97,7 +100,7 @@ class ExpressEndpoint : EndpointDetector.EndpointNameDeterminer { return promise.future() } - private fun locateRouter(routerVariable: JSVariable): String? { + private fun locateRouter(routerVariable: JSInitializerOwner): String? { if (isExpressApp(routerVariable)) { return "" }