diff --git a/pcbnew/router/pns_shove.cpp b/pcbnew/router/pns_shove.cpp index 14db9d0855..99a9609c88 100644 --- a/pcbnew/router/pns_shove.cpp +++ b/pcbnew/router/pns_shove.cpp @@ -530,6 +530,12 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::pushVia( PNS_VIA* aVia, const VECTOR2I& aForc PNS_JOINT* jt = m_currentNode->FindJoint( p0, aVia ); VECTOR2I p0_pushed( p0 + aForce ); + if( !jt ) + { + TRACEn( 1, "weird, can't find the center-of-via joint\n" ); + return SH_INCOMPLETE; + } + if( jt->IsLocked() ) return SH_INCOMPLETE; @@ -543,12 +549,6 @@ PNS_SHOVE::SHOVE_STATUS PNS_SHOVE::pushVia( PNS_VIA* aVia, const VECTOR2I& aForc p0_pushed += aForce.Resize( 2 ); // make sure pushed via does not overlap with any existing joint } - if( !jt ) - { - TRACEn( 1, "weird, can't find the center-of-via joint\n" ); - return SH_INCOMPLETE; - } - PNS_VIA* pushedVia = aVia->Clone(); pushedVia->SetPos( p0_pushed ); pushedVia->Mark( aVia->Marker() ); diff --git a/pcbnew/tools/drawing_tool.cpp b/pcbnew/tools/drawing_tool.cpp index 00f38e00eb..3af20517fd 100644 --- a/pcbnew/tools/drawing_tool.cpp +++ b/pcbnew/tools/drawing_tool.cpp @@ -541,8 +541,12 @@ int DRAWING_TOOL::PlaceDXF( const TOOL_EVENT& aEvent ) } delete item; - m_board->m_Modules->Add( converted ); - m_view->Add( converted ); + + if( converted ) + { + m_board->m_Modules->Add( converted ); + m_view->Add( converted ); + } } } else