Skip to content

Commit

Permalink
fix: avoid appending to empty reaper_state tables
Browse files Browse the repository at this point in the history
  • Loading branch information
gwatcha committed Aug 23, 2021
1 parent 0927fe0 commit 8435f68
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions internal/utils/reaper_state.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ end

function reaper_state.append(name, key, new_data)
local all_data = reaper_state.get(name)
if not all_data then
all_data = {}
all_data[key] = new_data
reaper_state.set(name, all_data)
return
end

if all_data[key] then
table.insert(all_data[key], new_data)
else
Expand Down

0 comments on commit 8435f68

Please sign in to comment.