From b1fa02bcc8dbe04807ef57c5fa988aa1c2e9a79a Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sat, 20 Mar 2021 11:04:36 +0000 Subject: [PATCH] Push a non-existent ref's value as 0. (Don't just crash.) Fixes https://gitlab.com/kicad/code/kicad/issues/7971 --- common/libeval_compiler/libeval_compiler.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/common/libeval_compiler/libeval_compiler.cpp b/common/libeval_compiler/libeval_compiler.cpp index 4f812f114c..e45681dd6e 100644 --- a/common/libeval_compiler/libeval_compiler.cpp +++ b/common/libeval_compiler/libeval_compiler.cpp @@ -1088,8 +1088,11 @@ void UOP::Exec( CONTEXT* ctx ) { case TR_UOP_PUSH_VAR: { - auto value = ctx->AllocValue(); - value->Set( m_ref->GetValue( ctx ) ); + VALUE* value = ctx->AllocValue(); + + if( m_ref ) + value->Set( m_ref->GetValue( ctx ) ); + ctx->Push( value ); } break;