From c84752b9a7c19cb732c52513313736821e52acd9 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Sat, 16 Feb 2019 13:28:45 -0800 Subject: [PATCH] commit: protect against un-copyable error This creates early asserts for issues where we haven't fully implemented a Clone() function for items or haven't correctly filtered them before creating the undo/redo commit. --- common/commit.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/common/commit.cpp b/common/commit.cpp index 2185760229..f97af8c889 100644 --- a/common/commit.cpp +++ b/common/commit.cpp @@ -64,7 +64,19 @@ COMMIT& COMMIT::Stage( EDA_ITEM* aItem, CHANGE_TYPE aChangeType ) case CHT_MODIFY: { EDA_ITEM* parent = parentObject( aItem ); - return createModified( parent, parent->Clone(), flag ); + EDA_ITEM* clone = nullptr; + + assert( parent ); + + if( parent ) + clone = parent->Clone(); + + assert( clone ); + + if( clone ) + return createModified( parent, clone, flag ); + + break; } default: