From a65accd412a15a030c4be9c659826f4500f72ee5 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Mon, 20 Mar 2023 16:07:08 +0100 Subject: [PATCH] EDA_SHAPE_DESC(): catch a std::runtime_error when emitted by template T Get( PROPERTY_BASE* aProperty ) to avoid a crash, and displays in Debug mode the runtime error message. From master branch. Fixes #14347 https://gitlab.com/kicad/code/kicad/issues/14347 --- common/eda_shape.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/common/eda_shape.cpp b/common/eda_shape.cpp index a0a25a8d91..3fb784642d 100644 --- a/common/eda_shape.cpp +++ b/common/eda_shape.cpp @@ -1736,7 +1736,17 @@ static struct EDA_SHAPE_DESC filled->SetAvailableFunc( [=]( INSPECTABLE* aItem ) -> bool { - SHAPE_T itemShape = aItem->Get( shape ); + SHAPE_T itemShape; + + try + { + itemShape = aItem->Get( shape ); + } + catch( std::runtime_error& err ) + { + wxFAIL_MSG( err.what() ); + return false; + } switch( itemShape ) {