summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/slang/slang-ir-lower-l-value-cast.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/source/slang/slang-ir-lower-l-value-cast.cpp b/source/slang/slang-ir-lower-l-value-cast.cpp
index 3d3c15132..058589862 100644
--- a/source/slang/slang-ir-lower-l-value-cast.cpp
+++ b/source/slang/slang-ir-lower-l-value-cast.cpp
@@ -175,8 +175,17 @@ struct LValueCastLoweringContext
IRBuilder builder(m_module);
- IRType* toValueType = as<IRPtrType>(toType)->getValueType();
- IRType* fromValueType = as<IRPtrType>(fromType)->getValueType();
+ auto toPtrType = as<IRPtrTypeBase>(toType);
+ auto fromPtrType = as<IRPtrTypeBase>(fromType);
+
+ if (!toPtrType || !fromPtrType)
+ {
+ // If either type is not a pointer type, we cannot process this L-value cast
+ return;
+ }
+
+ IRType* toValueType = toPtrType->getValueType();
+ IRType* fromValueType = fromPtrType->getValueType();
for (auto useSite : useSites)
{