From 8435f68d16d75bf1358128f5cab62318c3c79b6f Mon Sep 17 00:00:00 2001 From: michael Date: Mon, 23 Aug 2021 12:09:39 -0700 Subject: [PATCH] fix: avoid appending to empty reaper_state tables --- internal/utils/reaper_state.lua | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/internal/utils/reaper_state.lua b/internal/utils/reaper_state.lua index 8edb0049..bd0bf3fe 100644 --- a/internal/utils/reaper_state.lua +++ b/internal/utils/reaper_state.lua @@ -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