Skip to content

Commit

Permalink
Add missing check for if restart_data was initialised
Browse files Browse the repository at this point in the history
  • Loading branch information
cyderize authored and zayenz committed Dec 14, 2023
1 parent ada2231 commit 4a00bc5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions gecode/flatzinc.hh
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,7 @@ namespace Gecode { namespace FlatZinc {
object(new OnRestartData());
}
}
bool initialized() const { return object() != nullptr; }
OnRestartData& operator ()() {
return *static_cast<OnRestartData*>(object());
};
Expand Down
2 changes: 1 addition & 1 deletion gecode/flatzinc/flatzinc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2010,7 +2010,7 @@ namespace Gecode { namespace FlatZinc {
bool
FlatZincSpace::slave(const MetaInfo& mi) {
if (mi.type() == MetaInfo::RESTART) {
if (restart_data().mark_complete) {
if (restart_data.initialized() && restart_data().mark_complete) {
// Fail the space
this->fail();
// Return true to signal we are in the global search space
Expand Down

0 comments on commit 4a00bc5

Please sign in to comment.