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:
jean-pierre charras 2020-08-08 09:56:48 +02:00
parent 9bc3028eb7
commit ba5ab99a03
2 changed files with 5 additions and 2 deletions

View File

@ -102,7 +102,7 @@ public:
*/
int GetNetCode() const
{
return m_netinfo->GetNet();
return m_netinfo ? m_netinfo->GetNet() : -1;
}
/**

View File

@ -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 )
{