Create map if it does not exist

This commit is contained in:
Marcel Otte 2022-01-30 00:26:14 +01:00
parent fe83c16934
commit 87109b6bf0
1 changed files with 3 additions and 0 deletions

View File

@ -159,6 +159,9 @@ func (r *Runs) Load(db Database) {
// Save saves the data into the json database // Save saves the data into the json database
func (r *Runs) Save(db Database) { func (r *Runs) Save(db Database) {
if db.data == nil {
db.data = map[string]string{}
}
str, err := json.Marshal(r.data) str, err := json.Marshal(r.data)
if err != nil { if err != nil {
panic(err) panic(err)