Added checks to ensure VIEW_ITEM_DATA != nullptr.

This commit is contained in:
Maciej Suminski 2016-12-09 15:48:34 +01:00
parent c96db4f5c4
commit 8f924ed125
1 changed files with 24 additions and 1 deletions

View File

@ -846,6 +846,9 @@ void VIEW::draw( VIEW_ITEM* aItem, int aLayer, bool aImmediate )
{
auto viewData = aItem->viewPrivData();
if( !viewData )
return;
if( IsCached( aLayer ) && !aImmediate )
{
// Draw using cached information or create one
@ -918,6 +921,10 @@ struct VIEW::recacheItem
bool operator()( VIEW_ITEM* aItem )
{
auto viewData = aItem->viewPrivData();
if( !viewData )
return false;
// Remove previously cached group
int group = viewData->getGroup( layer );
@ -1096,6 +1103,9 @@ void VIEW::updateItemColor( VIEW_ITEM* aItem, int aLayer )
wxASSERT( (unsigned) aLayer < m_layers.size() );
wxASSERT( IsCached( aLayer ) );
if( !viewData )
return;
// Obtain the color that should be used for coloring the item on the specific layerId
const COLOR4D color = m_painter->GetSettings()->GetColor( aItem, aLayer );
int group = viewData->getGroup( aLayer );
@ -1112,6 +1122,9 @@ void VIEW::updateItemGeometry( VIEW_ITEM* aItem, int aLayer )
wxASSERT( (unsigned) aLayer < m_layers.size() );
wxASSERT( IsCached( aLayer ) );
if( !viewData )
return;
VIEW_LAYER& l = m_layers.at( aLayer );
m_gal->SetTarget( l.target );
@ -1154,6 +1167,9 @@ void VIEW::updateLayers( VIEW_ITEM* aItem )
auto viewData = aItem->viewPrivData();
int layers[VIEW_MAX_LAYERS], layers_count;
if( !viewData )
return;
// Remove the item from previous layer set
viewData->getLayers( layers, layers_count );
@ -1234,6 +1250,9 @@ void VIEW::UpdateItems()
{
auto viewData = item->viewPrivData();
if( !viewData )
continue;
if( viewData->m_requiredUpdate != NONE )
invalidateItem( item, viewData->m_requiredUpdate );
@ -1285,7 +1304,8 @@ void VIEW::SetVisible( VIEW_ITEM* aItem, bool aIsVisible )
{
auto viewData = aItem->viewPrivData();
assert( viewData );
if( !viewData )
return;
bool cur_visible = viewData->m_flags & VISIBLE;
@ -1305,6 +1325,9 @@ void VIEW::Hide( VIEW_ITEM* aItem, bool aHide )
{
auto viewData = aItem->viewPrivData();
if( !viewData )
return;
if( !( viewData->m_flags & VISIBLE ) )
return;