diff options
-rw-r--r-- | iolib.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -41,7 +41,7 @@ static void pushresult (int i) | |||
41 | static FILE *getfile (char *name) | 41 | static FILE *getfile (char *name) |
42 | { | 42 | { |
43 | lua_Object f = lua_getglobal(name); | 43 | lua_Object f = lua_getglobal(name); |
44 | if (lua_tag(f) != lua_tagio) | 44 | if (!lua_isuserdata(f) || lua_tag(f) != lua_tagio) |
45 | luaL_verror("global variable %s is not a file handle", name); | 45 | luaL_verror("global variable %s is not a file handle", name); |
46 | return lua_getuserdata(f); | 46 | return lua_getuserdata(f); |
47 | } | 47 | } |