Kaydet (Commit) bdf9ece3 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Actually check the return values of the various Coin* calls

...the code had been like this ever since it got introduced with
6d492447 "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
üst 040204ab
......@@ -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 );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment