darknight1050 / SongDownloader

Ingame SongDownloader for Beatsaber on the Oculus Quest
GNU General Public License v3.0
20 stars 12 forks source link

Set a default value for user stats to prevent error in scenario where the user has no stats #31

Closed madsbacha closed 1 month ago

madsbacha commented 1 month ago

Set a default value for user stats to prevent error in scenario where the user has no stats.

In some scenarios, the stats object on the user looks like this:

"stats": {
  "diffStats": {
    "total": 0,
    "easy": 0,
    "normal": 0,
    "hard": 0,
    "expert": 0,
    "expertPlus": 0
  }
},

To fix the issue, we want to set a default value for these parameters to prevent the mod from throwing the error ".stats.totalUpvotes not found error"

Fixes #20

FrozenAlex commented 1 month ago

Looks good to me. Thank you for your contribution!