From 53752ad8de37cb6597561d72fc67e5bf1278a62f Mon Sep 17 00:00:00 2001 From: david Date: Thu, 22 Nov 2007 08:31:13 +0000 Subject: [PATCH] Change l_exc_finalize to recognize both nil and false as exception indicators. Previously only nil did this but most of NSE's internal functions return nil. A value of true means there was no exception and anything else is a fatal error. --- nse_nmaplib.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/nse_nmaplib.cc b/nse_nmaplib.cc index f114f9f38..57072d4dd 100644 --- a/nse_nmaplib.cc +++ b/nse_nmaplib.cc @@ -470,13 +470,15 @@ static int l_print_debug_unformatted(lua_State *l) { } static int l_exc_finalize(lua_State *l) { - if (lua_isnil(l, 1)) { + if (!lua_toboolean(l, 1)) { + /* false or nil. */ lua_pushvalue(l, lua_upvalueindex(1)); lua_call(l, 0, 0); lua_settop(l, 2); lua_error(l); return 0; - } else if(lua_toboolean(l, 1)) { + } else if(lua_isboolean(l, 1) && lua_toboolean(l, 1)) { + /* true. */ lua_remove(l, 1); return lua_gettop(l); } else {