diff --git a/src/lua/fiber.cc b/src/lua/fiber.cc index da0fd2ae7d62784fb0236e96f5e08017056916e6..f422a8c37ece215c4a6578cdacb58ffd025b194d 100644 --- a/src/lua/fiber.cc +++ b/src/lua/fiber.cc @@ -762,6 +762,8 @@ lbox_fiber_self(struct lua_State *L) static int lbox_fiber_find(struct lua_State *L) { + if (lua_gettop(L) != 1) + luaL_error(L, "fiber.find(id): bad arguments"); int fid = lua_tointeger(L, -1); struct fiber *f = fiber_find(fid); if (f) diff --git a/test/box/fiber.result b/test/box/fiber.result index c50d6a0f6366ffbbfc92ca8bec63f562a0bafde9..5461d492fe5356512643348fddb934f37890e790 100644 --- a/test/box/fiber.result +++ b/test/box/fiber.result @@ -280,3 +280,11 @@ box.fiber.find(920) space:drop() --- ... +box.fiber.find() +--- +- error: 'fiber.find(id): bad arguments' +... +box.fiber.find('test') +--- +- null +... diff --git a/test/box/fiber.test.lua b/test/box/fiber.test.lua index 82d4b99e6f75c48793082aa91ec3a191f62a6b9d..17af822c8bb73e8a0e663f92f8f9e57d01e77219 100644 --- a/test/box/fiber.test.lua +++ b/test/box/fiber.test.lua @@ -97,3 +97,5 @@ box.fiber.find(900) box.fiber.find(910) box.fiber.find(920) space:drop() +box.fiber.find() +box.fiber.find('test')