vcl/quartz/ctfonts.cxx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
New commits: commit b521e0c8b04cef4c0140704c3c5221d2b645f8e4 Author: Patrick Luby <plub...@libreoffice.org> AuthorDate: Sat Dec 9 17:59:10 2023 -0500 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Mon Dec 11 10:28:08 2023 +0100 tdf#140401 check if attribute is a nullptr Change-Id: Ie6e33fc1dca525553bb4237204666835d335b13f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160524 Tested-by: Jenkins Reviewed-by: Patrick Luby <plub...@libreoffice.org> (cherry picked from commit 99ba9c34f2785d1236820cbd5f604339ccd28952) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160486 Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/vcl/quartz/ctfonts.cxx b/vcl/quartz/ctfonts.cxx index 38112a7deb50..a770509e5b3f 100644 --- a/vcl/quartz/ctfonts.cxx +++ b/vcl/quartz/ctfonts.cxx @@ -386,7 +386,9 @@ FontAttributes DevFontFromCTFontDescriptor( CTFontDescriptorRef pFD, bool* bFont // get the font weight double fWeight = 0; CFNumberRef pWeightNum = static_cast<CFNumberRef>(CFDictionaryGetValue( pAttrDict, kCTFontWeightTrait )); - CFNumberGetValue( pWeightNum, kCFNumberDoubleType, &fWeight ); + // tdf#140401 check if attribute is a nullptr + if( pWeightNum ) + CFNumberGetValue( pWeightNum, kCFNumberDoubleType, &fWeight ); int nInt = WEIGHT_NORMAL; // Special case fixes @@ -432,7 +434,9 @@ FontAttributes DevFontFromCTFontDescriptor( CTFontDescriptorRef pFD, bool* bFont // get the font slant double fSlant = 0; CFNumberRef pSlantNum = static_cast<CFNumberRef>(CFDictionaryGetValue( pAttrDict, kCTFontSlantTrait )); - CFNumberGetValue( pSlantNum, kCFNumberDoubleType, &fSlant ); + // tdf#140401 check if attribute is a nullptr + if( pSlantNum ) + CFNumberGetValue( pSlantNum, kCFNumberDoubleType, &fSlant ); if( fSlant >= 0.035 ) { rDFA.SetItalic( ITALIC_NORMAL ); @@ -440,7 +444,9 @@ FontAttributes DevFontFromCTFontDescriptor( CTFontDescriptorRef pFD, bool* bFont // get width trait double fWidth = 0; CFNumberRef pWidthNum = static_cast<CFNumberRef>(CFDictionaryGetValue( pAttrDict, kCTFontWidthTrait )); - CFNumberGetValue( pWidthNum, kCFNumberDoubleType, &fWidth ); + // tdf#140401 check if attribute is a nullptr + if( pWidthNum ) + CFNumberGetValue( pWidthNum, kCFNumberDoubleType, &fWidth ); nInt = WIDTH_NORMAL; if( fWidth > 0 )