summaryrefslogtreecommitdiffstatshomepage
path: root/plugins
diff options
context:
space:
mode:
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