summaryrefslogtreecommitdiff
path: root/basic/source/comp/exprtree.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'basic/source/comp/exprtree.cxx')
-rw-r--r--basic/source/comp/exprtree.cxx18
1 files changed, 15 insertions, 3 deletions
diff --git a/basic/source/comp/exprtree.cxx b/basic/source/comp/exprtree.cxx
index 710965dd56cb..1a4b465ded02 100644
--- a/basic/source/comp/exprtree.cxx
+++ b/basic/source/comp/exprtree.cxx
@@ -819,10 +819,22 @@ short SbiConstExpression::GetShortValue()
else
{
double n = nVal;
- if( n > 0 ) n += .5; else n -= .5;
- if( n > SbxMAXINT ) n = SbxMAXINT, pParser->Error( SbERR_OUT_OF_RANGE );
+ if( n > 0 )
+ n += .5;
else
- if( n < SbxMININT ) n = SbxMININT, pParser->Error( SbERR_OUT_OF_RANGE );
+ n -= .5;
+
+ if( n > SbxMAXINT )
+ {
+ n = SbxMAXINT;
+ pParser->Error( SbERR_OUT_OF_RANGE );
+ }
+ else if( n < SbxMININT )
+ {
+ n = SbxMININT;
+ pParser->Error( SbERR_OUT_OF_RANGE );
+ }
+
return (short) n;
}
}