From 3b18fa84bfd1da945fef06ef364ed6f338f45d5b Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sun, 29 Nov 2020 10:54:50 +0000 Subject: [PATCH] Null pointer safety (from Coverity). --- common/page_layout/ws_data_item.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/common/page_layout/ws_data_item.cpp b/common/page_layout/ws_data_item.cpp index 6d6a398637..c8509c4515 100644 --- a/common/page_layout/ws_data_item.cpp +++ b/common/page_layout/ws_data_item.cpp @@ -755,6 +755,12 @@ void WS_DATA_ITEM_BITMAP::SyncDrawItems( WS_DRAW_ITEM_LIST* aCollector, KIGFX::V delete item; } + if( aCollector ) + { + double pix_size_iu = aCollector->GetMilsToIUfactor() * 1000 / m_ImageBitmap->GetPPI(); + m_ImageBitmap->SetPixelSizeIu( pix_size_iu ); + } + m_drawItems.clear(); for( int j = 0; j < m_RepeatCount; j++ ) @@ -762,9 +768,6 @@ void WS_DATA_ITEM_BITMAP::SyncDrawItems( WS_DRAW_ITEM_LIST* aCollector, KIGFX::V if( j && !IsInsidePage( j ) ) continue; - double pix_size_iu = aCollector->GetMilsToIUfactor() * 1000 / m_ImageBitmap->GetPPI(); - m_ImageBitmap->SetPixelSizeIu( pix_size_iu ); - WS_DRAW_ITEM_BITMAP* bitmap = new WS_DRAW_ITEM_BITMAP( this, j, GetStartPosUi( j ) ); bitmap->SetFlags( itemFlags[ j ] );