pcbnew: More about Prevent use of non-connected item in ratsnest
Another static cast was left. changed now to dyn_cast We need to be careful in the connectivity system to always use dyn_cast/dynamic_cast and check the return when dealing with board items. Fixes https://gitlab.com/kicad/code/kicad/issues/5082
This commit is contained in:
parent
9bc3028eb7
commit
ba5ab99a03
|
@ -102,7 +102,7 @@ public:
|
|||
*/
|
||||
int GetNetCode() const
|
||||
{
|
||||
return m_netinfo->GetNet();
|
||||
return m_netinfo ? m_netinfo->GetNet() : -1;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -666,7 +666,10 @@ const std::vector<CN_EDGE> CONNECTIVITY_DATA::GetRatsnestForItems( std::vector<B
|
|||
|
||||
for( auto item : aItems )
|
||||
{
|
||||
auto conn_item = static_cast<BOARD_CONNECTED_ITEM*>( item );
|
||||
BOARD_CONNECTED_ITEM* conn_item = dyn_cast<BOARD_CONNECTED_ITEM*>( item );
|
||||
|
||||
if( !conn_item )
|
||||
continue;
|
||||
|
||||
if( item->Type() == PCB_MODULE_T )
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue