summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Foley <tim.foley.is@gmail.com>2020-01-09 14:19:14 -0800
committerGitHub <noreply@github.com>2020-01-09 14:19:14 -0800
commitf2a123d727316d8203820a332da1348f78ad9ad6 (patch)
treeb9095e1206c20c9918716f247f5d15e95f62aa21
parent0a856f458ff9f17d76bc646d008602713c6c66d1 (diff)
parent63bed4c37199f2436c81089a08834d7b58b8e576 (diff)
Merge pull request #1165 from tfoleyNV/fix-find-type-crash
Catch exceptions inside FindTypeByName()
-rw-r--r--source/slang/slang-reflection.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/source/slang/slang-reflection.cpp b/source/slang/slang-reflection.cpp
index c0c5bd72f..037bc2d97 100644
--- a/source/slang/slang-reflection.cpp
+++ b/source/slang/slang-reflection.cpp
@@ -598,8 +598,15 @@ SLANG_API SlangReflectionType * spReflection_FindTypeByName(SlangReflection * re
Slang::DiagnosticSink sink(
programLayout->getTargetReq()->getLinkage()->getSourceManager());
- RefPtr<Type> result = program->getTypeFromString(name, &sink);
- return (SlangReflectionType*)result.Ptr();
+ try
+ {
+ RefPtr<Type> result = program->getTypeFromString(name, &sink);
+ return (SlangReflectionType*)result.Ptr();
+ }
+ catch( ... )
+ {
+ return nullptr;
+ }
}
SLANG_API SlangReflectionTypeLayout* spReflection_GetTypeLayout(