From: Mikko Rasa Date: Thu, 1 Aug 2024 14:55:44 +0000 (+0300) Subject: Avoid a crash in DepthRangeConverter if there are no stages X-Git-Url: https://git.tdb.fi/?a=commitdiff_plain;h=ff8be6f70d6a2de080f4a286f5480198ee6e2371;p=libs%2Fgl.git Avoid a crash in DepthRangeConverter if there are no stages --- 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()