1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-16 15:29:55 +00:00

Add missing type validation in mwlua/objectvariant.hpp

This commit is contained in:
Petr Mikheev 2023-04-23 20:47:24 +02:00
parent 6f246e084a
commit 073e379057

View file

@ -18,8 +18,10 @@ namespace MWLua
mVariant.emplace<SelfObject*>(obj.as<SelfObject*>());
else if (obj.is<LObject>())
mVariant.emplace<LObject>(obj.as<LObject>());
else
else if (obj.is<GObject>())
mVariant.emplace<GObject>(obj.as<GObject>());
else
throw std::runtime_error("Expected game object, got: " + LuaUtil::toString(obj));
}
bool isSelfObject() const { return std::holds_alternative<SelfObject*>(mVariant); }