From afa611c36dd14a6faf9e307c8b9e5b32611ec682 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Mon, 9 Oct 2006 01:15:09 +0000 Subject: [PATCH] fix error handling --- stepmania/src/EnumHelper.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/stepmania/src/EnumHelper.cpp b/stepmania/src/EnumHelper.cpp index 99106d5f0a..06d6b4a0e5 100644 --- a/stepmania/src/EnumHelper.cpp +++ b/stepmania/src/EnumHelper.cpp @@ -83,11 +83,9 @@ namespace { luaL_checktype( L, 1, LUA_TTABLE ); - /* Look up the reverse table. */ - luaL_getmetafield( L, 1, "reverse" ); - - /* If there was no metafield, then we were called on the wrong type. */ - if( lua_isnil(L, -1) ) + /* Look up the reverse table. If there is no metafield, then we were + * called on the wrong type. */ + if( !luaL_getmetafield(L, 1, "reverse") ) luaL_typerror( L, 1, "enum" ); return 1;