diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-07-28 09:01:19 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-07-28 16:52:06 +0200 |
commit | e8493f9349d18cbcb323930a9bf200c542a72d62 (patch) | |
tree | a682aeb0343b0379a2a9d2d9ea39a7f096115050 /basic | |
parent | ff41cf1b8dbeb36b8824257acb5c5ba272415108 (diff) |
loplugin:collapseif
Change-Id: I69bfafa97c66ef944cc6ae35c7e2f66d0430d6a4
Reviewed-on: https://gerrit.libreoffice.org/76496
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'basic')
-rw-r--r-- | basic/source/sbx/sbxvalue.cxx | 63 |
1 files changed, 30 insertions, 33 deletions
diff --git a/basic/source/sbx/sbxvalue.cxx b/basic/source/sbx/sbxvalue.cxx index 1a011b6706d1..37f8cffbf413 100644 --- a/basic/source/sbx/sbxvalue.cxx +++ b/basic/source/sbx/sbxvalue.cxx @@ -976,43 +976,40 @@ bool SbxValue::Compute( SbxOperator eOp, const SbxValue& rOp ) { aL.eType = aR.eType = SbxDECIMAL; bDecimal = true; - if( rOp.Get( aR ) ) + if( rOp.Get( aR ) && Get( aL ) ) { - if( Get( aL ) ) + if( aL.pDecimal && aR.pDecimal ) { - if( aL.pDecimal && aR.pDecimal ) - { - bool bOk = true; - switch( eOp ) - { - case SbxMUL: - bOk = ( *(aL.pDecimal) *= *(aR.pDecimal) ); - break; - case SbxDIV: - if( aR.pDecimal->isZero() ) - SetError( ERRCODE_BASIC_ZERODIV ); - else - bOk = ( *(aL.pDecimal) /= *(aR.pDecimal) ); - break; - case SbxPLUS: - bOk = ( *(aL.pDecimal) += *(aR.pDecimal) ); - break; - case SbxMINUS: - bOk = ( *(aL.pDecimal) -= *(aR.pDecimal) ); - break; - case SbxNEG: - bOk = ( aL.pDecimal->neg() ); - break; - default: - SetError( ERRCODE_BASIC_BAD_ARGUMENT ); - } - if( !bOk ) - SetError( ERRCODE_BASIC_MATH_OVERFLOW ); - } - else + bool bOk = true; + switch( eOp ) { - SetError( ERRCODE_BASIC_CONVERSION ); + case SbxMUL: + bOk = ( *(aL.pDecimal) *= *(aR.pDecimal) ); + break; + case SbxDIV: + if( aR.pDecimal->isZero() ) + SetError( ERRCODE_BASIC_ZERODIV ); + else + bOk = ( *(aL.pDecimal) /= *(aR.pDecimal) ); + break; + case SbxPLUS: + bOk = ( *(aL.pDecimal) += *(aR.pDecimal) ); + break; + case SbxMINUS: + bOk = ( *(aL.pDecimal) -= *(aR.pDecimal) ); + break; + case SbxNEG: + bOk = ( aL.pDecimal->neg() ); + break; + default: + SetError( ERRCODE_BASIC_BAD_ARGUMENT ); } + if( !bOk ) + SetError( ERRCODE_BASIC_MATH_OVERFLOW ); + } + else + { + SetError( ERRCODE_BASIC_CONVERSION ); } } } |