Skip to content

Commit 2f9cf1f

Browse files
authored
Merge pull request #2430 from darrylmelander/fix-callback-crash
Fix callback crash
2 parents a52140a + 0a55aa8 commit 2f9cf1f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

highs/lp_data/Highs.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2328,9 +2328,10 @@ HighsStatus Highs::setCallback(HighsCCallbackType c_callback,
23282328
const HighsCallbackOutput* cb_out,
23292329
HighsCallbackInput* cb_in, void* e) {
23302330
HighsCallbackDataOut cc_out = static_cast<HighsCallbackDataOut>(*cb_out);
2331-
HighsCallbackDataIn cc_in = static_cast<HighsCallbackDataIn>(*cb_in);
2331+
HighsCallbackDataIn cc_in;
2332+
if (cb_in) cc_in = static_cast<HighsCallbackDataIn>(*cb_in);
23322333
c_callback(a, b.c_str(), &cc_out, &cc_in, e);
2333-
*cb_in = cc_in; // copy the data in
2334+
if (cb_in) *cb_in = cc_in; // copy the data in
23342335
};
23352336
this->callback_.user_callback_data = user_callback_data;
23362337

0 commit comments

Comments
 (0)