Explorar o código

Fix error generation in load*.

Reported by Sergey Kaplun. #1353
Mike Pall hai 5 meses
pai
achega
e76bb50d44
Modificáronse 1 ficheiros con 2 adicións e 1 borrados
  1. 2 1
      src/lj_load.c

+ 2 - 1
src/lj_load.c

@@ -108,8 +108,9 @@ LUALIB_API int luaL_loadfilex(lua_State *L, const char *filename,
     copyTV(L, L->top-1, L->top);
   }
   if (err) {
+    const char *fname = filename ? filename : "stdin";
     L->top--;
-    lua_pushfstring(L, "cannot read %s: %s", chunkname+1, strerror(err));
+    lua_pushfstring(L, "cannot read %s: %s", fname, strerror(err));
     return LUA_ERRFILE;
   }
   return status;