mirror of
https://github.com/minetest/minetest.git
synced 2025-07-06 01:40:21 +02:00
Increase safety checks around ObjectRefs
This commit is contained in:
@ -22,7 +22,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
class MockServerActiveObject : public ServerActiveObject
|
||||
{
|
||||
public:
|
||||
MockServerActiveObject(ServerEnvironment *env = nullptr, const v3f &p = v3f()) :
|
||||
MockServerActiveObject(ServerEnvironment *env = nullptr, v3f p = v3f()) :
|
||||
ServerActiveObject(env, p) {}
|
||||
|
||||
virtual ActiveObjectType getType() const { return ACTIVEOBJECT_TYPE_TEST; }
|
||||
|
@ -68,6 +68,8 @@ void TestMoveAction::runTests(IGameDef *gamedef)
|
||||
auto null_map = std::unique_ptr<ServerMap>();
|
||||
ServerEnvironment server_env(std::move(null_map), &server, &mb);
|
||||
MockServerActiveObject obj(&server_env);
|
||||
obj.setId(1);
|
||||
server.getScriptIface()->addObjectReference(&obj);
|
||||
|
||||
TEST(testMove, &obj, gamedef);
|
||||
TEST(testMoveFillStack, &obj, gamedef);
|
||||
@ -82,6 +84,8 @@ void TestMoveAction::runTests(IGameDef *gamedef)
|
||||
|
||||
TEST(testCallbacks, &obj, &server);
|
||||
TEST(testCallbacksSwap, &obj, &server);
|
||||
|
||||
server.getScriptIface()->removeObjectReference(&obj);
|
||||
}
|
||||
|
||||
static ItemStack parse_itemstack(const char *s)
|
||||
|
Reference in New Issue
Block a user