Skip to content

Commit

Permalink
Merge pull request #272 from luvit/linting-fixes
Browse files Browse the repository at this point in the history
Adds some nil checks
  • Loading branch information
SinisterRectus authored Jan 18, 2023
2 parents 4e0f23b + b0f7568 commit 72b7488
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion samples/repl.app/repl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ limitations under the License.

return function (stdin, stdout, uv, utils, greeting)

local loadstring = loadstring or load

local print = function(...)
uv.write(stdout, table.concat({...}, "\t") .. "\n")
end
Expand Down Expand Up @@ -67,7 +69,7 @@ return function (stdin, stdout, uv, utils, greeting)
end
else

if err:match "'<eof>'$" then
if err and err:match "'<eof>'$" then
-- Lua expects some more input; stow it away for next time
buffer = chunk .. '\n'
return '>>'
Expand Down
1 change: 1 addition & 0 deletions samples/repl.app/utils.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
local uv = require('uv')
local env = require('env')

local unpack = unpack or table.unpack
local prettyPrint, dump, strip, color, colorize, loadColors
local theme = {}
local useColors = false
Expand Down
2 changes: 1 addition & 1 deletion src/lua/luvibundle.lua
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ local function zipBundle(base, zip)

-- Support zips with a single folder inserted at top-level
local entries = bundle.readdir("")
if #entries == 1 and bundle.stat(entries[1]).type == "directory" then
if entries and #entries == 1 and bundle.stat(entries[1]).type == "directory" then
chrootBundle(bundle, entries[1] .. '/')
end

Expand Down

0 comments on commit 72b7488

Please sign in to comment.