瀏覽代碼

Improve error checking in love.physics.new*Shape

Sasha Szpakowski 2 年之前
父節點
當前提交
de3a0c0142
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      src/modules/physics/box2d/wrap_Physics.cpp

+ 1 - 1
src/modules/physics/box2d/wrap_Physics.cpp

@@ -275,7 +275,7 @@ int w_newFixture(lua_State *L)
 
 
 static Body *luax_optbodyforshape(lua_State *L, int idx, const char *name)
 static Body *luax_optbodyforshape(lua_State *L, int idx, const char *name)
 {
 {
-	if (luax_istype(L, idx, Body::type))
+	if (lua_isnoneornil(L, idx) || luax_istype(L, idx, Object::type))
 		return luax_checkbody(L, idx);
 		return luax_checkbody(L, idx);
 
 
 	luax_markdeprecated(L, 1, name, API_FUNCTION_VARIANT, DEPRECATED_REPLACED, "variant with Body parameter");
 	luax_markdeprecated(L, 1, name, API_FUNCTION_VARIANT, DEPRECATED_REPLACED, "variant with Body parameter");