diff --git a/src/olympic/studio/modlib/include/studio/editor.hpp b/src/olympic/studio/modlib/include/studio/editor.hpp index 59b7e2f0..31421dcb 100644 --- a/src/olympic/studio/modlib/include/studio/editor.hpp +++ b/src/olympic/studio/modlib/include/studio/editor.hpp @@ -134,11 +134,13 @@ class Editor: public studio::BaseEditor { void pushCommand(ox::UPtr &&cmd) noexcept; template - void pushCommand(Args&&... args) noexcept { + bool pushCommand(Args&&... args) noexcept { try { m_undoStack.push(ox::make_unique(ox::forward(args)...)); + return true; } catch (ox::Exception const&ex) { oxLogError(ex.toError()); + return false; } } diff --git a/src/olympic/studio/modlib/include/studio/undocommand.hpp b/src/olympic/studio/modlib/include/studio/undocommand.hpp index 9f7bb845..93e04f13 100644 --- a/src/olympic/studio/modlib/include/studio/undocommand.hpp +++ b/src/olympic/studio/modlib/include/studio/undocommand.hpp @@ -4,8 +4,15 @@ #pragma once +#include + namespace studio { +class NoChangesException: public ox::Exception { + public: + inline NoChangesException(): ox::Exception(OxError(1, "Command makes no changes.")) {} +}; + class UndoCommand { public: virtual ~UndoCommand() noexcept = default;