Eeschema: avoid crashes when the tool highlight or delete is activated and clicking in a empty schematic.
Was a nullptr not tested.
This commit is contained in:
parent
98124e68c7
commit
70ff2e14a5
|
@ -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<LIB_PART*>( aItem )->Visit( m_inspector, nullptr, m_ScanTypes );
|
||||
else
|
||||
EDA_ITEM::IterateForward( aItem, m_inspector, nullptr, m_ScanTypes );
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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 ) );
|
||||
|
|
Loading…
Reference in New Issue