summaryrefslogtreecommitdiff
path: root/sccomp
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2015-10-07 15:05:53 +0200
committerStephan Bergmann <sbergman@redhat.com>2015-10-07 15:43:45 +0200
commitbdf9ece338b3e50ddb17b4f94fb9e7f7d8e54398 (patch)
treefa302077abb4456783a25b0ab781d0f4c96194c4 /sccomp
parent040204abd72108a9c72ad6cb56b19324d1a718d6 (diff)
Actually check the return values of the various Coin* calls
...the code had been like this ever since it got introduced with 6d492447a37ec268fb5924e7fc5631c29c67325d "118160: Use CoinMP as replacement for lp_solve," but it looks more plausible that the return values should be checked rather than be ignored. At least, CppunitTest_sccomp_lpsolver keeps succeeding after the change (with --enable-coinmp). Change-Id: If450827ae034079c9ee69b4e49c55b480ac0de06
Diffstat (limited to 'sccomp')
-rw-r--r--sccomp/source/solver/CoinMPSolver.cxx23
1 files changed, 16 insertions, 7 deletions
diff --git a/sccomp/source/solver/CoinMPSolver.cxx b/sccomp/source/solver/CoinMPSolver.cxx
index b650d0673421..5edf90366128 100644
--- a/sccomp/source/solver/CoinMPSolver.cxx
+++ b/sccomp/source/solver/CoinMPSolver.cxx
@@ -294,7 +294,10 @@ void SAL_CALL CoinMPSolver::solve() throw(uno::RuntimeException, std::exception)
pLowerBounds, pUpperBounds, pRowType, pRHS, NULL,
pMatrixBegin, pMatrixCount, pMatrixIndex, pMatrix,
NULL, NULL, NULL );
- nResult = CoinLoadInteger( hProb, pColType );
+ if (nResult == SOLV_CALL_SUCCESS)
+ {
+ nResult = CoinLoadInteger( hProb, pColType );
+ }
delete[] pColType;
delete[] pMatrixIndex;
@@ -314,15 +317,21 @@ void SAL_CALL CoinMPSolver::solve() throw(uno::RuntimeException, std::exception)
// solve model
- nResult = CoinCheckProblem( hProb );
-
- try
+ if (nResult == SOLV_CALL_SUCCESS)
{
- nResult = CoinOptimizeProblem( hProb, 0 );
+ nResult = CoinCheckProblem( hProb );
}
- catch (const CoinError& e)
+
+ if (nResult == SOLV_CALL_SUCCESS)
{
- throw std::runtime_error(e.message());
+ try
+ {
+ nResult = CoinOptimizeProblem( hProb, 0 );
+ }
+ catch (const CoinError& e)
+ {
+ throw std::runtime_error(e.message());
+ }
}
mbSuccess = ( nResult == SOLV_CALL_SUCCESS );