r317 - trunk

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sun May 27 14:37:53 EDT 2007


Author: icculus
Date: 2007-05-27 14:37:53 -0400 (Sun, 27 May 2007)
New Revision: 317

Modified:
   trunk/lua_glue.c
Log:
Minor argument checking fixes in the lua_glue.


Modified: trunk/lua_glue.c
===================================================================
--- trunk/lua_glue.c	2007-05-27 18:20:51 UTC (rev 316)
+++ trunk/lua_glue.c	2007-05-27 18:37:53 UTC (rev 317)
@@ -626,8 +626,8 @@
 {
     const int argc = lua_gettop(L);
     const char *arg = luaL_checkstring(L, 1);
-    const char *envr = (argc < 2) ? NULL : lua_tostring(L, 2);
-    const char *deflt = (argc < 3) ? NULL : lua_tostring(L, 3);
+    const char *envr = (argc < 2) ? NULL : luaL_checkstring(L, 2);
+    const char *deflt = (argc < 3) ? NULL : luaL_checkstring(L, 3);
     return retvalString(L, cmdlinestr(arg, envr, deflt));
 } // luahook_cmdlinestr
 
@@ -887,9 +887,10 @@
 
 static int luahook_platform_mkdir(lua_State *L)
 {
+    const int argc = lua_gettop(L);
     const char *dir = luaL_checkstring(L, 1);
     uint16 perms = 0;
-    if (lua_isnil(L, 2))
+    if ( (argc < 2) || (lua_isnil(L, 2)) )
         perms = MojoPlatform_defaultDirPerms();
     else
     {




More information about the mojosetup-commits mailing list