From 37143802781d8d480361d7c23202347ae3acf094 Mon Sep 17 00:00:00 2001 From: Yong He Date: Mon, 14 Jul 2025 18:51:57 -0700 Subject: Fix language server crash. (#7756) * Fix language server crash. * Fix tests. * Fix. * Revert changes. --- source/slang/slang-syntax.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'source/slang/slang-syntax.cpp') diff --git a/source/slang/slang-syntax.cpp b/source/slang/slang-syntax.cpp index bb5b574bb..67d562f0f 100644 --- a/source/slang/slang-syntax.cpp +++ b/source/slang/slang-syntax.cpp @@ -912,11 +912,19 @@ FuncType* getFuncType(ASTBuilder* astBuilder, DeclRef const& declR { List paramTypes; auto resultType = getResultType(astBuilder, declRef); + + if (!resultType) + resultType = astBuilder->getErrorType(); + auto errorType = getErrorCodeType(astBuilder, declRef); auto visitParamDecl = [&](DeclRef paramDeclRef) { auto paramDecl = paramDeclRef.getDecl(); auto paramType = getParamType(astBuilder, paramDeclRef); + if (!paramType) + { + paramType = astBuilder->getErrorType(); + } if (paramDecl->findModifier()) { paramType = astBuilder->getRefType(paramType, AddressSpace::Generic); -- cgit v1.2.3