Skip to content

Commit

Permalink
Add fallback for ReadSystemSaveData
Browse files Browse the repository at this point in the history
  • Loading branch information
patapancakes committed Jun 21, 2024
1 parent 64a2007 commit d12eae0
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion db/savedata.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
package db

import (
"bytes"
"encoding/gob"
"encoding/json"

"github.com/klauspost/compress/zstd"
Expand Down Expand Up @@ -67,7 +69,13 @@ func ReadSystemSaveData(uuid []byte) (defs.SystemSaveData, error) {

decompressed, err := zstdDecoder.DecodeAll(data, nil)
if err != nil {
return system, err
// compat
err = gob.NewDecoder(bytes.NewReader(data)).Decode(&system)
if err != nil {
return system, err
}

return system, nil
}

err = json.Unmarshal(decompressed, &system)
Expand Down

0 comments on commit d12eae0

Please sign in to comment.