From 0ab27aa4e3bcc5f8fcbffde1f32100fc0ea5d055 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Fri, 23 Mar 2018 21:38:21 +0100 Subject: [PATCH] [dxbc] Check if the signature is nullptr before using it Fixes a crash in The Witcher 3. --- src/dxbc/dxbc_analysis.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/dxbc/dxbc_analysis.cpp b/src/dxbc/dxbc_analysis.cpp index 3ad6d21e7..c9c980174 100644 --- a/src/dxbc/dxbc_analysis.cpp +++ b/src/dxbc/dxbc_analysis.cpp @@ -49,13 +49,15 @@ namespace dxvk { DxbcClipCullInfo DxbcAnalyzer::getClipCullInfo(const Rc& sgn) const { DxbcClipCullInfo result; - for (auto e = sgn->begin(); e != sgn->end(); e++) { - const uint32_t componentCount = e->componentMask.popCount(); - - if (e->systemValue == DxbcSystemValue::ClipDistance) - result.numClipPlanes += componentCount; - if (e->systemValue == DxbcSystemValue::CullDistance) - result.numCullPlanes += componentCount; + if (sgn != nullptr) { + for (auto e = sgn->begin(); e != sgn->end(); e++) { + const uint32_t componentCount = e->componentMask.popCount(); + + if (e->systemValue == DxbcSystemValue::ClipDistance) + result.numClipPlanes += componentCount; + if (e->systemValue == DxbcSystemValue::CullDistance) + result.numCullPlanes += componentCount; + } } return result;