summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCollin <iCollin@users.noreply.github.com>2021-09-09 14:25:46 -0400
committerGitHub <noreply@github.com>2021-09-09 14:25:46 -0400
commit28e1fdbb56f022459203c11fc4f71fe17bf6c350 (patch)
tree507875d0f53ccb95cfc6974925f2e6c975b848d3
parent35f5a0684a36a2a965d5f0e9e784687fa7d82914 (diff)
downloadsdl_core-28e1fdbb56f022459203c11fc4f71fe17bf6c350.tar.gz
Clear Parent Reference to Begin State When it is Erased (#3769)
* clear any parent reference to the state being erased even when it is the begin state * Apply suggestions from code review Co-authored-by: Jacob Keeler <jacob.keeler@livioradio.com> Co-authored-by: Jacob Keeler <jacob.keeler@livioradio.com>
-rw-r--r--src/components/application_manager/src/application_state.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/components/application_manager/src/application_state.cc b/src/components/application_manager/src/application_state.cc
index adaefd2e95..ee43d32b0a 100644
--- a/src/components/application_manager/src/application_state.cc
+++ b/src/components/application_manager/src/application_state.cc
@@ -205,7 +205,12 @@ void ApplicationState::RemoveHMIState(const WindowID window_id,
void ApplicationState::EraseHMIState(HmiStates& hmi_states,
HmiStates::iterator it) {
if (hmi_states.begin() == it) {
- (*it)->set_parent(nullptr);
+ HmiStates::iterator next = it;
+ ++next;
+ if (hmi_states.end() != next) {
+ HmiStatePtr next_state = *next;
+ next_state->set_parent(nullptr);
+ }
} else {
HmiStates::iterator next = it;
HmiStates::iterator prev = it;