diff --git a/src/common/scripting/backend/codegen.cpp b/src/common/scripting/backend/codegen.cpp index 92b68d703a..1fcaeae2c5 100644 --- a/src/common/scripting/backend/codegen.cpp +++ b/src/common/scripting/backend/codegen.cpp @@ -12367,7 +12367,7 @@ static PClass *NativeNameToClass(int _clsname, PClass *desttype) if (clsname != NAME_None) { cls = PClass::FindClass(clsname); - if (cls != nullptr && (cls->VMType == nullptr || !cls->IsDescendantOf(desttype))) + if (cls != nullptr && (cls->VMType == nullptr || (desttype != nullptr && !cls->IsDescendantOf(desttype)))) { // does not match required parameters or is invalid. return nullptr; diff --git a/wadsrc/static/zscript/engine/base.zs b/wadsrc/static/zscript/engine/base.zs index 70710d7dee..fa212ba38f 100644 --- a/wadsrc/static/zscript/engine/base.zs +++ b/wadsrc/static/zscript/engine/base.zs @@ -771,6 +771,7 @@ class Object native private native static bool CheckDeprecatedFlags(Object obj, int index); native static Name ValidateNameIndex(int index); + static class FindClass(Name cls, class baseType = null) { return BuiltinNameToClass(cls, baseType); } native static uint MSTime(); native static double MSTimeF();