From f83e71e99a3c51d390c7034d6998c30afba3d801 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Thu, 5 Nov 2015 08:36:32 +0100 Subject: [PATCH] 22483 Dereference after null check --- src/bind_building.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/bind_building.c b/src/bind_building.c index 714b915dd..b8fb07611 100644 --- a/src/bind_building.c +++ b/src/bind_building.c @@ -193,11 +193,9 @@ static int tolua_building_create(lua_State * L) const char *bname = tolua_tostring(L, 2, 0); if (!r) { log_error("building.create expects a region as argument 1"); - } - if (!bname) { + } else if (!bname) { log_error("building.create expects a name as argument 2"); - } - if (bname) { + } else { const building_type *btype = bt_find(bname); if (btype) { building *b = new_building(btype, r, default_locale);