diff --git a/src/screen.cc b/src/screen.cc index c37ff9d..df17293 100644 --- a/src/screen.cc +++ b/src/screen.cc @@ -14,7 +14,21 @@ Screen::Screen(std::weak_ptr stack) : stack(stack) {} ScreenStack::PendingAction::PendingAction() : screen(), action(Action::NOP) {} ScreenStack::PendingAction::PendingAction(Action action) - : screen(), action(action) {} + : screen(), action(action) { + switch (action) { + case Action::PUSH_SCREEN: + case Action::CONSTRUCT_SCREEN: + // Cannot push non-existant screen. + this->action = Action::NOP; +#ifndef NDEBUG + std::clog << "WARNING: Cannot create PendingAction with PUSH_SCREEN or " + "CONSTRUCT_SCREEN!\n"; +#endif + break; + default: + break; + } +} ScreenStack::PendingAction::PendingAction(Screen::Ptr &&screen) : screen(std::forward(screen)), action(Action::PUSH_SCREEN) {}