cid#1660799 silence Dereference null return value

Change-Id: I7392878e4e17bc70d11c13122bd657ad5a531dd4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188887
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Jenkins
This commit is contained in:
Caolán McNamara
2025-08-04 12:36:12 +02:00
parent c4a0af44d7
commit bb4f58f1a3
2 changed files with 9 additions and 4 deletions
+2
View File
@@ -227,6 +227,8 @@ private:
const Color*& rpColor );
SVX_DLLPRIVATE static void PosToCategory_Impl(sal_uInt16 nPos, SvNumFormatType& rCategory);
SVX_DLLPRIVATE static void CategoryToPos_Impl(SvNumFormatType nCategory, sal_uInt16& rPos);
SVX_DLLPRIVATE bool IsNotNatNum12(short nEntry) const;
};
#endif
+7 -4
View File
@@ -1328,6 +1328,12 @@ bool SvxNumberFormatShell::GetUserDefined4Entry(short nEntry)
return false;
}
bool SvxNumberFormatShell::IsNotNatNum12(short nEntry) const
{
const SvNumberformat* pNumEntry = pFormatter->GetEntry(aCurEntryList[nEntry]);
return !pNumEntry || pNumEntry->GetFormatstring().indexOf("NatNum12") < 0;
}
/*
* Function: Returns the format string for a given entry.
* Input: Number of the entry
@@ -1338,10 +1344,7 @@ OUString SvxNumberFormatShell::GetFormat4Entry(short nEntry)
if (nEntry < 0)
return OUString();
if (!aCurrencyFormatList.empty()
&& (!pFormatter->GetEntry(aCurEntryList[nEntry])
|| pFormatter->GetEntry(aCurEntryList[nEntry])->GetFormatstring().indexOf("NatNum12")
< 0))
if (!aCurrencyFormatList.empty() && IsNotNatNum12(nEntry))
{
if (aCurrencyFormatList.size() > o3tl::make_unsigned(nEntry))
return aCurrencyFormatList[nEntry];