diff --git a/eeschema/ee_collectors.cpp b/eeschema/ee_collectors.cpp index b1af5aa737..e0b2b9a214 100644 --- a/eeschema/ee_collectors.cpp +++ b/eeschema/ee_collectors.cpp @@ -104,7 +104,8 @@ void EE_COLLECTOR::Collect( EDA_ITEM* aItem, const KICAD_T aFilterList[], const // remember where the snapshot was taken from and pass refPos to the Inspect() function. SetRefPos( aPos ); - if( aItem->Type() == LIB_PART_T ) + // aItem can be null for empty schematics + if( aItem && aItem->Type() == LIB_PART_T ) static_cast( aItem )->Visit( m_inspector, nullptr, m_ScanTypes ); else EDA_ITEM::IterateForward( aItem, m_inspector, nullptr, m_ScanTypes ); diff --git a/eeschema/tools/ee_picker_tool.h b/eeschema/tools/ee_picker_tool.h index 00c064a022..0a8b67da79 100644 --- a/eeschema/tools/ee_picker_tool.h +++ b/eeschema/tools/ee_picker_tool.h @@ -74,7 +74,7 @@ public: */ inline void SetClickHandler( CLICK_HANDLER aHandler ) { - assert( !m_clickHandler ); + wxASSERT( !m_clickHandler ); m_clickHandler = aHandler; } @@ -84,7 +84,7 @@ public: */ inline void SetMotionHandler( MOTION_HANDLER aHandler ) { - assert( !m_motionHandler ); + wxASSERT( !m_motionHandler ); m_motionHandler = aHandler; } @@ -94,7 +94,7 @@ public: */ inline void SetCancelHandler( CANCEL_HANDLER aHandler ) { - assert( !m_cancelHandler ); + wxASSERT( !m_cancelHandler ); m_cancelHandler = aHandler; } @@ -104,7 +104,7 @@ public: */ inline void SetFinalizeHandler( FINALIZE_HANDLER aHandler ) { - assert( !m_finalizeHandler ); + wxASSERT( !m_finalizeHandler ); m_finalizeHandler = aHandler; } diff --git a/eeschema/tools/ee_selection_tool.cpp b/eeschema/tools/ee_selection_tool.cpp index b04361549c..8488c2c188 100644 --- a/eeschema/tools/ee_selection_tool.cpp +++ b/eeschema/tools/ee_selection_tool.cpp @@ -764,6 +764,9 @@ static KICAD_T nodeTypes[] = EDA_ITEM* EE_SELECTION_TOOL::GetNode( VECTOR2I aPosition ) { + if( m_frame->GetScreen()->GetDrawItems() == nullptr ) // Empty schematics + return nullptr; + EE_COLLECTOR collector; int thresholdMax = KiROUND( getView()->ToWorld( HITTEST_THRESHOLD_PIXELS ) );