From 2c3593b51eef193eb543a08eb1e83c37e2fafe72 Mon Sep 17 00:00:00 2001
From: rubenwardy <rw@rubenwardy.com>
Date: Wed, 23 Dec 2020 16:39:29 +0000
Subject: Fix unsafe cast in l_object

---
 src/script/lua_api/l_object.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'src/script/lua_api')

diff --git a/src/script/lua_api/l_object.cpp b/src/script/lua_api/l_object.cpp
index bc59bd55c..4d7a1bc41 100644
--- a/src/script/lua_api/l_object.cpp
+++ b/src/script/lua_api/l_object.cpp
@@ -1409,7 +1409,7 @@ int ObjectRef::l_set_physics_override(lua_State *L)
 {
 	NO_MAP_LOCK_REQUIRED;
 	ObjectRef *ref = checkobject(L, 1);
-	PlayerSAO *playersao = (PlayerSAO *) getobject(ref);
+	PlayerSAO *playersao = getplayersao(ref);
 	if (playersao == nullptr)
 		return 0;
 
@@ -1449,7 +1449,7 @@ int ObjectRef::l_get_physics_override(lua_State *L)
 {
 	NO_MAP_LOCK_REQUIRED;
 	ObjectRef *ref = checkobject(L, 1);
-	PlayerSAO *playersao = (PlayerSAO *)getobject(ref);
+	PlayerSAO *playersao = getplayersao(ref);
 	if (playersao == nullptr)
 		return 0;
 
-- 
cgit v1.2.3