Skip to content

Commit

Permalink
Don't crash if you get one of these "{}" entries that 1Password makes.
Browse files Browse the repository at this point in the history
It looks like some version of 1Password has obsolete entries that still have
JSON files listed, but the entirety of the JSON is "{}" ... we now check if we
got an empty table back from the Lua JSON parser and treat it as a dead entry.
  • Loading branch information
icculus committed Jul 9, 2014
1 parent c45bd4a commit 5f9c188
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion 1pass.lua
Expand Up @@ -246,7 +246,7 @@ secret_menuitem_builders["securenotes.SecureNote"] = build_secret_menuitem_secur

local function build_secret_menuitems(info, menu)
local metadata = load_json(basedir .. "/" .. info.uuid .. ".1password")
if metadata == nil then
if (metadata == nil) or (next(metadata) == nil) then -- the "next" trick tests if table is empty.
return
end

Expand Down

0 comments on commit 5f9c188

Please sign in to comment.