From c7d88dcbe8813db3e7a039306076a8986570dacb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jianxiang=20Wang=20=28=E7=8E=8B=E5=81=A5=E7=BF=94=29?= Date: Wed, 15 May 2024 02:51:11 +0800 Subject: [PATCH] Fix crash when opening construction menu with no visible entries (#73785) --- src/construction.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/construction.cpp b/src/construction.cpp index 15de3e1c8f564..2cb4ff54d096d 100644 --- a/src/construction.cpp +++ b/src/construction.cpp @@ -952,7 +952,7 @@ construction_id construction_menu( const bool blueprint ) if( select < 0 || static_cast( select ) >= constructs.size() || con_preview_group != constructs[select] ) { - con_preview_group = ( select >= 0 || static_cast( select ) < constructs.size() ) + con_preview_group = ( select >= 0 && static_cast( select ) < constructs.size() ) ? constructs[select] : construction_group_str_id::NULL_ID(); if( con_preview_group.is_null() ) { con_preview.clear();