}
// check if default container exists, throw ContainerOperationException if not found
- if (mContainers.find(mConfig.defaultId) == mContainers.end()) {
+ if (!mConfig.defaultId.empty() && mContainers.find(mConfig.defaultId) == mContainers.end()) {
LOGE("Provided default container ID " << mConfig.defaultId << " is invalid.");
throw ContainerOperationException("Provided default container ID " + mConfig.defaultId +
" is invalid.");
return c1.second->getPrivilege() < c2.second->getPrivilege();
});
- mConfig.foregroundId = foregroundIterator->second->getId();
- LOGI(mConfig.foregroundId << ": no foreground container configured, setting one with highest priority");
- foregroundIterator->second->goForeground();
+ if (foregroundIterator != mContainers.end()) {
+ mConfig.foregroundId = foregroundIterator->second->getId();
+ LOGI(mConfig.foregroundId << ": no foreground container configured, setting one with highest priority");
+ foregroundIterator->second->goForeground();
+ }
}
}
LOGI("switchingSequenceMonitorNotify() called");
auto nextContainerId = getNextToForegroundContainerId();
- focus(nextContainerId);
+
+ if (!nextContainerId.empty()) {
+ focus(nextContainerId);
+ }
}