Throw clean exception when no volatile script is found when adding one.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
79c4d28c75
commit
2e5d463e45
|
@ -129,6 +129,11 @@ void Battle::AddVolatileScript(const ConstString& key) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
script = _library->LoadScript(ScriptCategory::Battle, key);
|
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);
|
return _volatile.Add(script);
|
||||||
}
|
}
|
||||||
void Battle::AddVolatileScript(Script* script) { return _volatile.Add(script); }
|
void Battle::AddVolatileScript(Script* script) { return _volatile.Add(script); }
|
||||||
|
|
|
@ -217,6 +217,11 @@ void Battling::Creature::AddVolatileScript(const ConstString& name) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
script = this->_library->LoadScript(ScriptCategory::Creature, name);
|
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);
|
_volatile.Add(script);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue