diff --git a/src/Battling/Models/Battle.cpp b/src/Battling/Models/Battle.cpp index a8f3155..1a6f8c4 100644 --- a/src/Battling/Models/Battle.cpp +++ b/src/Battling/Models/Battle.cpp @@ -129,6 +129,11 @@ void Battle::AddVolatileScript(const ConstString& key) { return; } script = _library->LoadScript(ScriptCategory::Battle, key); + if (script == nullptr) { + std::stringstream ss; + ss << "Invalid volatile script requested for battle: '" << key.c_str() << "'."; + throw CreatureException(ss.str()); + } return _volatile.Add(script); } void Battle::AddVolatileScript(Script* script) { return _volatile.Add(script); } diff --git a/src/Battling/Models/Creature.cpp b/src/Battling/Models/Creature.cpp index 688e7b5..984fc4c 100644 --- a/src/Battling/Models/Creature.cpp +++ b/src/Battling/Models/Creature.cpp @@ -217,6 +217,11 @@ void Battling::Creature::AddVolatileScript(const ConstString& name) { return; } script = this->_library->LoadScript(ScriptCategory::Creature, name); + if (script == nullptr) { + std::stringstream ss; + ss << "Invalid volatile script requested for creature: '" << name.c_str() << "'."; + throw CreatureException(ss.str()); + } _volatile.Add(script); }