fix crash when resetting the state after clearing the graph

This commit is contained in:
2026-02-27 03:36:10 +01:00
parent f512306109
commit fc5988adb2

View File

@ -81,13 +81,13 @@ auto StateManager::ResetState() -> void {
} }
visited_states[current_state]++; visited_states[current_state]++;
total_moves = 0; total_moves = 0;
if (edited) { if (edited || !states.contains(current_state)) {
// We also need to clear the graph in case the state has been edited // We also need to clear the graph in case the state has been edited
// because the graph could contain states that are impossible to reach // because the graph could contain states that are impossible to reach
// now. // now.
ClearGraph(); ClearGraph();
edited = false;
} }
edited = false;
} }
auto StateManager::PreviousPreset() -> void { auto StateManager::PreviousPreset() -> void {