Skip to content

Commit

Permalink
Avoid crash in CBC when bestSolution is nullptr
Browse files Browse the repository at this point in the history
Fixes #592
  • Loading branch information
cyderize committed Jun 22, 2022
1 parent 0c354d1 commit 49599d8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ Bug fixes:
duration is zero. (:bugref:`589`)
- Fix handling of float values in ``.mpc`` parameter configuration files.
- Fix crash in SCIP plugin due to incorrect loading of ``SCIPinfinity`` symbol.
- Fix crash in CBC when there is a heuristic solution but no best solution
(:bugref:`592`).

.. _v2.6.3:

Expand Down
5 changes: 4 additions & 1 deletion solvers/MIP/MIP_osicbc_wrap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,10 @@ CbcEventHandler::CbcAction MyEventHandler3::event(CbcEvent whichEvent) {
// If preprocessing was done solution will be to processed model
// int numberColumns = model_->getNumCols();
const double* bestSolution = model_->bestSolution();
assert(bestSolution);
if (bestSolution == nullptr) {
// Could happen if we only have heuristic solution?
return noAction;
}
// printf("value of solution is %g\n",model_->getObjValue());

// Trying to obtain solution for the original model:
Expand Down

0 comments on commit 49599d8

Please sign in to comment.