summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2011-08-01 09:52:01 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2011-08-01 09:52:01 (GMT)
commitac2912f2d236204ab82613f29bc17579bf57bf66 (patch)
treeb8a6ecb9cfb6989c96d3ae7fe85da6980779c3c6 /src
parent8dfa09bf6a4a4e30e6e26b6af4eb9b0c275c0d56 (diff)
downloadpowder-ac2912f2d236204ab82613f29bc17579bf57bf66.zip
powder-ac2912f2d236204ab82613f29bc17579bf57bf66.tar.gz
Ensure menu ID is valid for active_menu
Diffstat (limited to 'src')
-rw-r--r--src/luaconsole.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/luaconsole.c b/src/luaconsole.c
index 8dce665..6e4df7c 100644
--- a/src/luaconsole.c
+++ b/src/luaconsole.c
@@ -855,12 +855,12 @@ int luatpt_airheat(lua_State* l)
}
int luatpt_active_menu(lua_State* l)
{
- int aheatstate;
- aheatstate = luaL_optint(l, 1, menu_count);
- if (aheatstate < SC_TOTAL)
- active_menu = aheatstate;
+ int menuid;
+ menuid = luaL_optint(l, 1, 0);
+ if (menuid < SC_TOTAL && menuid > 0)
+ active_menu = menuid;
else
- return luaL_error(l, "Menu does not exist");
+ return luaL_error(l, "Invalid menu");
return 0;
}
int luatpt_decorations_enable(lua_State* l)