summaryrefslogtreecommitdiff
path: root/svl
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2012-02-28 16:07:33 +0100
committerEike Rathke <erack@redhat.com>2012-02-28 16:08:06 +0100
commitef37bb6a02674cf676cadcd69445b4deadad9be6 (patch)
tree071b9e1265f564430f34c7b31a0b85b9f8531edb /svl
parent20c25d497a0d35a68a7dea9a0d7bc5b667a40ad4 (diff)
fixed crashes due to transition from Table to std::map
Old code used Table Seek/Next followed by GetCurKey() that returned -1 (or some such? anyway) if after the last element, comparing with another key. Replacement code did not check for valid iterators. Crash happened when changing the locale within the number formatter and obtaining the default currency format. May also have happened when changing the default locale and documents using a number formatter were open.
Diffstat (limited to 'svl')
-rw-r--r--svl/source/numbers/zforlist.cxx6
1 files changed, 3 insertions, 3 deletions
diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx
index ca3ca49a8138..c454843ff018 100644
--- a/svl/source/numbers/zforlist.cxx
+++ b/svl/source/numbers/zforlist.cxx
@@ -367,7 +367,7 @@ void SvNumberFormatter::ImpChangeSysCL( LanguageType eLnge, bool bLoadingSO5 )
{ // delete additional standard formats
sal_uInt32 nKey;
SvNumberFormatTable::iterator it = aFTable.find( SV_MAX_ANZ_STANDARD_FORMATE + 1 );
- while ( (nKey = it->first) > SV_MAX_ANZ_STANDARD_FORMATE &&
+ while ( it != aFTable.end() && (nKey = it->first) > SV_MAX_ANZ_STANDARD_FORMATE &&
nKey < SV_COUNTRY_LANGUAGE_OFFSET )
{
delete it->second;
@@ -1293,7 +1293,7 @@ sal_uInt32 SvNumberFormatter::ImpGetDefaultFormat( short nType )
sal_uInt32 nStopKey = CLOffset + SV_COUNTRY_LANGUAGE_OFFSET;
sal_uInt32 nKey;
SvNumberFormatTable::iterator it2 = aFTable.find( CLOffset );
- while ( (nKey = it2->first ) >= CLOffset && nKey < nStopKey )
+ while ( it2 != aFTable.end() && (nKey = it2->first ) >= CLOffset && nKey < nStopKey )
{
const SvNumberformat* pEntry = it2->second;
if ( pEntry->IsStandard() && ((pEntry->GetType() &
@@ -3263,7 +3263,7 @@ sal_uInt32 SvNumberFormatter::ImpGetDefaultCurrencyFormat()
sal_uInt32 nStopKey = CLOffset + SV_COUNTRY_LANGUAGE_OFFSET;
sal_uInt32 nKey;
SvNumberFormatTable::iterator it2 = aFTable.lower_bound( CLOffset );
- while ( (nKey = it2->first) >= CLOffset && nKey < nStopKey )
+ while ( it2 != aFTable.end() && (nKey = it2->first) >= CLOffset && nKey < nStopKey )
{
const SvNumberformat* pEntry = it2->second;
if ( pEntry->IsStandard() && (pEntry->GetType() & NUMBERFORMAT_CURRENCY) )