Fix nullptr dereference.

Fixes: lp:8996
* https://bugs.launchpad.net/kicad/+bug/8996
This commit is contained in:
Jeff Young 2021-08-19 11:58:47 +01:00
parent 8dab9041e4
commit 0843fbf904
1 changed files with 7 additions and 1 deletions

View File

@ -449,6 +449,10 @@ void C3D_RENDER_RAYTRACING::reload( REPORTER *aStatusTextReporter )
++ii ) ++ii )
{ {
PCB_LAYER_ID layer_id = static_cast<PCB_LAYER_ID>(ii->first); PCB_LAYER_ID layer_id = static_cast<PCB_LAYER_ID>(ii->first);
const CBVHCONTAINER2D *container2d = static_cast<const CBVHCONTAINER2D *>(ii->second);
if( !container2d )
continue;
// Mask kayers are not processed here because they are a special case // Mask kayers are not processed here because they are a special case
if( (layer_id == B_Mask) || (layer_id == F_Mask) ) if( (layer_id == B_Mask) || (layer_id == F_Mask) )
@ -509,7 +513,6 @@ void C3D_RENDER_RAYTRACING::reload( REPORTER *aStatusTextReporter )
break; break;
} }
const CBVHCONTAINER2D *container2d = static_cast<const CBVHCONTAINER2D *>(ii->second);
const LIST_OBJECT2D &listObject2d = container2d->GetList(); const LIST_OBJECT2D &listObject2d = container2d->GetList();
for( LIST_OBJECT2D::const_iterator itemOnLayer = listObject2d.begin(); for( LIST_OBJECT2D::const_iterator itemOnLayer = listObject2d.begin();
@ -655,6 +658,9 @@ void C3D_RENDER_RAYTRACING::reload( REPORTER *aStatusTextReporter )
const CBVHCONTAINER2D *containerLayer2d = const CBVHCONTAINER2D *containerLayer2d =
static_cast<const CBVHCONTAINER2D *>(ii->second); static_cast<const CBVHCONTAINER2D *>(ii->second);
if( !containerLayer2d )
continue;
// Only get the Solder mask layers // Only get the Solder mask layers
if( !((layer_id == B_Mask) || (layer_id == F_Mask)) ) if( !((layer_id == B_Mask) || (layer_id == F_Mask)) )
continue; continue;