diff --git a/pcbnew/board_commit.cpp b/pcbnew/board_commit.cpp index 2296c5ef55..a75dd1766e 100644 --- a/pcbnew/board_commit.cpp +++ b/pcbnew/board_commit.cpp @@ -122,12 +122,17 @@ void BOARD_COMMIT::Push( const wxString& aMessage, bool aCreateUndoEntry, bool a int changeFlags = ent.m_type & CHT_FLAGS; BOARD_ITEM* boardItem = static_cast( ent.m_item ); + wxASSERT( ent.m_item ); + // Module items need to be saved in the undo buffer before modification if( m_isFootprintEditor ) { // Be sure that we are storing a footprint if( ent.m_item->Type() != PCB_FOOTPRINT_T ) + { ent.m_item = ent.m_item->GetParent(); + wxASSERT( ent.m_item ); + } // We have not saved the footprint yet, so let's create an entry if( savedModules.count( ent.m_item ) == 0 ) diff --git a/pcbnew/tools/convert_tool.cpp b/pcbnew/tools/convert_tool.cpp index 28c3c499be..117febb301 100644 --- a/pcbnew/tools/convert_tool.cpp +++ b/pcbnew/tools/convert_tool.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -183,6 +184,10 @@ int CONVERT_TOOL::CreatePolys( const TOOL_EVENT& aEvent ) if( FP_SHAPE* graphic = dynamic_cast( selection.Front() ) ) parentFootprint = graphic->GetParentFootprint(); + else if( FP_ZONE* zone = dynamic_cast( selection.Front() ) ) + parentFootprint = static_cast( zone->GetParent() ); + else + wxFAIL_MSG( "Unimplemented footprint parent in CONVERT_TOOL::CreatePolys" ); BOARD_COMMIT commit( m_frame );