fix: plugin/download-counter: crash on empty file
Massimo Melina committed
Jul 26, 2022 at 12:44 UTC
23f7c2757bb59c456a8b68569412fc55aa02c768
1 file changed
+1
-1
plugins/download-counter/plugin.js
+1
-1
@@ -19,7 +19,7 @@ exports.init = async api => {
19
// load previous stats
20
try {
21
const data = await readFile(countersFile, 'utf8')
22
- counters = yaml.parse(data)
22
+ counters = yaml.parse(data) || {}
23
console.debug('counters loaded')
24
}
25
catch(err) {