Slight optimization and defensive programming.
continuous-integration/drone/push Build is failing Details

This commit is contained in:
Deukhoofd 2021-10-30 00:14:15 +02:00
parent ede314ef39
commit 475e2142c6
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
1 changed files with 4 additions and 1 deletions

View File

@ -19,7 +19,10 @@ AngelScriptScript::AngelScriptScript(const ArbUt::OptionalBorrowedPtr<void>& own
AngelScriptResolver* resolver, AngelScriptTypeInfo* type, asIScriptObject* obj,
ContextPool* ctxPool)
: PkmnLib::Battling::PkmnScript(owner), _resolver(resolver), _type(type), _ctxPool(ctxPool), _obj(obj) {
if (_type->GetGetOwner().Exists) {
if (_type->GetGetOwner().Exists && owner.HasValue()) {
if (ownerType == nullptr){
THROW("Script was created with owner value, but with unknown owner type.")
}
CScriptHandle* handle = nullptr;
AngelScriptUtils::AngelscriptFunctionCall(
_type->GetGetOwner().Function, _ctxPool, _obj, _resolver, GetName(), [&](asIScriptContext*) {},