summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolan.mcnamara@collabora.com>2024-04-26 11:11:44 +0100
committerCaolán McNamara <caolan.mcnamara@collabora.com>2024-04-29 09:30:48 +0200
commite5c988821db31f285cdd207e2a2ac849c0f1c099 (patch)
treec2703f5e8010a646d36551922b3fbd939c958dd8
parenta70a8f55973ec3e71f65335be75699f1d2a73d62 (diff)
WaE: C6011 Derefencing NULL pointer 'pMF'
Change-Id: I76e85e8671623f7cdf994dce779c3944b8761acf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166731 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
-rw-r--r--sfx2/source/doc/graphhelp.cxx41
1 files changed, 21 insertions, 20 deletions
diff --git a/sfx2/source/doc/graphhelp.cxx b/sfx2/source/doc/graphhelp.cxx
index 7cfdf76fe60f..9d7600ae2da7 100644
--- a/sfx2/source/doc/graphhelp.cxx
+++ b/sfx2/source/doc/graphhelp.cxx
@@ -128,28 +128,29 @@ void* GraphicHelper::getWinMetaFileFromGDI_Impl( const GDIMetaFile* pGDIMeta, co
if ( hMemory )
{
- METAFILEPICT* pMF = static_cast<METAFILEPICT*>(GlobalLock( hMemory ));
-
- pMF->hMF = hMeta;
- pMF->mm = MM_ANISOTROPIC;
-
- MapMode aWinMode( MapUnit::Map100thMM );
-
- if ( aWinMode == pGDIMeta->GetPrefMapMode() )
+ if (METAFILEPICT* pMF = static_cast<METAFILEPICT*>(GlobalLock(hMemory)))
{
- pMF->xExt = aMetaSize.Width();
- pMF->yExt = aMetaSize.Height();
+ pMF->hMF = hMeta;
+ pMF->mm = MM_ANISOTROPIC;
+
+ MapMode aWinMode( MapUnit::Map100thMM );
+
+ if ( aWinMode == pGDIMeta->GetPrefMapMode() )
+ {
+ pMF->xExt = aMetaSize.Width();
+ pMF->yExt = aMetaSize.Height();
+ }
+ else
+ {
+ Size aWinSize = OutputDevice::LogicToLogic( Size( aMetaSize.Width(), aMetaSize.Height() ),
+ pGDIMeta->GetPrefMapMode(),
+ aWinMode );
+ pMF->xExt = aWinSize.Width();
+ pMF->yExt = aWinSize.Height();
+ }
+
+ GlobalUnlock(hMemory);
}
- else
- {
- Size aWinSize = OutputDevice::LogicToLogic( Size( aMetaSize.Width(), aMetaSize.Height() ),
- pGDIMeta->GetPrefMapMode(),
- aWinMode );
- pMF->xExt = aWinSize.Width();
- pMF->yExt = aWinSize.Height();
- }
-
- GlobalUnlock( hMemory );
pResult = static_cast<void*>(hMemory);
}
else