summaryrefslogtreecommitdiffstatshomepage
path: root/plugins
diff options
context:
space:
mode:
author kunikuni <42865216+kunikunijp@users.noreply.github.com>2020-07-18 04:05:23 +0900
committer GitHub <noreply@github.com>2020-07-17 15:05:23 -0400
commit33fbb85d59a6f829df6631ff49cd9d6e43978349 (patch)
tree5c58d348e464e91964443e5d15530fc7da8fee20 /plugins
parent4f6f6e13c471d63c6ffaffc3da6a5ecfe58bc700 (diff)
plugins/autofire: don't save 2bytes cfg file (#6960)
Diffstat (limited to 'plugins')
-rw-r--r--plugins/autofire/autofire_save.lua7
1 files changed, 6 insertions, 1 deletions
diff --git a/plugins/autofire/autofire_save.lua b/plugins/autofire/autofire_save.lua
index 067368dd2b2..9aae0f9e418 100644
--- a/plugins/autofire/autofire_save.lua
+++ b/plugins/autofire/autofire_save.lua
@@ -76,9 +76,14 @@ function lib:save_settings(buttons)
end
local json = require('json')
local settings = serialize_settings(buttons)
+ local data = json.stringify(settings, {indent = true})
+ if string.len(data) <= 2 then
+ os.remove(path .. get_settings_filename())
+ return
+ end
local file = io.open(path .. get_settings_filename(), 'w')
if file then
- file:write(json.stringify(settings, {indent = true}))
+ file:write(data)
file:close()
end
end