return "Surface is not on any layer!";
}
- struct LayoutState &state = **this->layers.get_layout_state(*surface_id);
+ auto o_state = *this->layers.get_layout_state(*surface_id);
+
+ if (! o_state) {
+ return "Could not find layer for surface";
+ }
+
+ struct LayoutState &state = *o_state;
// disable layers that are above our current layer
for (auto const &l : this->layers.mapping) {
if (state.sub == -1) {
if (can_split) {
if (state.main != *surface_id) {
- std::string main = *this->lookup_name(state.main);
+ std::string main = std::move(*this->lookup_name(state.main));
this->emit_syncdraw(drawing_name);
this->emit_syncdraw(main.c_str());
return "Cannot deactivate main_surface";
}
- struct LayoutState &state = **this->layers.get_layout_state(*surface_id);
+ auto o_state = *this->layers.get_layout_state(*surface_id);
+
+ if (! o_state) {
+ return "Could not find layer for surface";
+ }
+
+ struct LayoutState &state = *o_state;
if (state.main == -1) {
return "No surface active";
if (state.main == *surface_id) {
if (state.sub != -1) {
- std::string sub = *this->lookup_name(state.sub);
+ std::string sub = std::move(*this->lookup_name(state.sub));
this->emit_syncdraw(sub.c_str());
this->deactivate(*surface_id);
state.main = -1;
}
}else if (state.sub == *surface_id) {
- std::string main = *this->lookup_name(state.main);
+ std::string main = std::move(*this->lookup_name(state.main));
this->emit_syncdraw(main.c_str());
this->deactivate(*surface_id);