[Fix] Properly fixed the valgrind issues without causing more.

This commit is contained in:
Allanis 2014-03-10 16:48:42 +00:00
parent cc3955c445
commit 40aa774ff7

View File

@ -1016,6 +1016,7 @@ static int ai_face(lua_State* L) {
/* Get first parameter, aka what to face. */ /* Get first parameter, aka what to face. */
n = -2; n = -2;
lv = NULL;
if(lua_isnumber(L, 1)) { if(lua_isnumber(L, 1)) {
n = (int)lua_tonumber(L, 1); n = (int)lua_tonumber(L, 1);
@ -1023,9 +1024,7 @@ static int ai_face(lua_State* L) {
p = pilot_get(n); p = pilot_get(n);
if(p == NULL) return 0; /* Make sure pilot is valid. */ if(p == NULL) return 0; /* Make sure pilot is valid. */
vect_cset(&tv, VX(p->solid->pos), VY(p->solid->pos)); vect_cset(&tv, VX(p->solid->pos), VY(p->solid->pos));
lv = NULL;
} }
else LLUA_INVALID_PARAMETER();
} }
else if(lua_isvector(L, 1)) else if(lua_isvector(L, 1))
lv = lua_tovector(L, 1); lv = lua_tovector(L, 1);