summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--svl/source/numbers/zformat.cxx14
1 files changed, 8 insertions, 6 deletions
diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx
index 38efb37be8c9..9f987f591035 100644
--- a/svl/source/numbers/zformat.cxx
+++ b/svl/source/numbers/zformat.cxx
@@ -2694,16 +2694,14 @@ bool SvNumberformat::ImpGetFractionOutput(double fNumber,
else
{
bRes |= ImpNumberFill(sFrac, fNumber, k, j, nIx, NF_SYMBOLTYPE_FRACBLANK);
+ bCont = false; // there is no main number?
if (rInfo.nTypeArray[j] == NF_SYMBOLTYPE_FRACBLANK)
{
sFrac.insert(0, rInfo.sStrArray[j]);
if ( j )
{
j--;
- }
- else
- {
- bCont = false;
+ bCont = true; // Yes, there is a main number
}
}
}
@@ -4294,6 +4292,7 @@ bool SvNumberformat::ImpNumberFill( OUStringBuffer& sBuff, // number string
short eSymbolType ) // type of stop condition
{
bool bRes = false;
+ bool bStop = false;
const ImpSvNumberformatInfo& rInfo = NumFor[nIx].Info();
// no normal thousands separators if number divided by thousands
bool bDoThousands = (rInfo.nThousand == 0);
@@ -4301,7 +4300,7 @@ bool SvNumberformat::ImpNumberFill( OUStringBuffer& sBuff, // number string
k = sBuff.getLength(); // behind last digit
- while (j > 0 && (nType = rInfo.nTypeArray[j]) != eSymbolType ) // Backwards
+ while (!bStop && (nType = rInfo.nTypeArray[j]) != eSymbolType ) // Backwards
{
switch ( nType )
{
@@ -4376,7 +4375,10 @@ bool SvNumberformat::ImpNumberFill( OUStringBuffer& sBuff, // number string
sBuff.insert(k, rInfo.sStrArray[j]);
break;
} // of switch
- j--; // Next String
+ if ( j )
+ j--; // Next String
+ else
+ bStop = true;
} // of while
return bRes;
}