Skip to content

Commit

Permalink
fix lua module register crash
Browse files Browse the repository at this point in the history
  • Loading branch information
starwing committed Jun 6, 2018
1 parent a7dd85a commit 7f92d67
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion pb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1659,7 +1659,8 @@ LUALIB_API int luaopen_pb(lua_State *L) {
};
luaL_Reg meta[] = {
{ "__gc", Lpb_delete },
{ "setdefault", Lpb_state }
{ "setdefault", Lpb_state },
{ NULL, NULL }
};
if (luaL_newmetatable(L, PB_STATE)) {
luaL_setfuncs(L, meta, 0);
Expand Down
2 changes: 1 addition & 1 deletion protoc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ function Parser:parsefile(name)
if info then return info end
local errors = {}
for _, path in ipairs(self.paths) do
local fn = path.."/"..name
local fn = path ~= "" and path.."/"..name or name
local fh, err = io.open(fn)
if fh then
local content = fh:read "*a"
Expand Down

0 comments on commit 7f92d67

Please sign in to comment.