From ff8be6f70d6a2de080f4a286f5480198ee6e2371 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Thu, 1 Aug 2024 17:55:44 +0300 Subject: [PATCH] Avoid a crash in DepthRangeConverter if there are no stages --- source/glsl/finalize.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/source/glsl/finalize.cpp b/source/glsl/finalize.cpp index 9d309785..2b7774c5 100644 --- a/source/glsl/finalize.cpp +++ b/source/glsl/finalize.cpp @@ -275,8 +275,11 @@ void DepthRangeConverter::apply(Module &module, const Features &features) if(features.target_api==VULKAN) return; - for(Stage *s=&module.stages.back(); (!r_position_z_assigned && s); s=s->previous) - s->content.visit(*this); + if(!module.stages.empty()) + { + for(Stage *s=&module.stages.back(); (!r_position_z_assigned && s); s=s->previous) + s->content.visit(*this); + } } unique_ptr DepthRangeConverter::create_conversion_statement() -- 2.45.2