From 8433052c649e3a79756edabbe35ea4a69e9babff Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Thu, 19 Sep 2019 05:05:13 +0200 Subject: [PATCH] CID 204092: Memory - illegal accesses (NEGATIVE_RETURNS) --- src/bind_unit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bind_unit.c b/src/bind_unit.c index 921dcc659..45b4d7d0a 100644 --- a/src/bind_unit.c +++ b/src/bind_unit.c @@ -531,8 +531,8 @@ static int tolua_unit_setskill(lua_State * L) bool rcmod = tolua_toboolean(L, 4, 0); skill_t sk = findskill(skname); - if (rcmod) level -= u_race(u)->bonus[sk]; if (sk != NOSKILL) { + if (rcmod) level -= u_race(u)->bonus[sk]; set_level(u, sk, level); lua_pushinteger(L, level); return 1;