Skip to content

Conversation

@luissilva1044894
Copy link
Contributor

Fixes #18

@malmeloo
Copy link
Collaborator

malmeloo commented Feb 5, 2023

Did you test this? I don't think it should make a difference:

>>> {}.get('empty', {})
{}
>>> {}.get('empty') or {}
{}

I'm honestly not even sure how the last_played var could be None

@luissilva1044894
Copy link
Contributor Author

Ofc it does! API returns null for last_played where code expects to be {}:

{
  "user":{
    "name":"DISCORDTAG",
    "id":"DISCORDID"
  },
  "tag_url":{
    "normal":"https://tag.rc24.xyz/DISCORDID/tag.png",
    "max":"https://tag.rc24.xyz/DISCORDID/tag.max.png"
  },
  "game_data":{
    "last_played":null,
    "games":[]
  }
}

@malmeloo
Copy link
Collaborator

malmeloo commented Feb 5, 2023

Oh I see! I think this might be a minor inconsistency with v1.0, I thought the key would simply be missing instead.

Thanks for the PR :)

@malmeloo malmeloo merged commit c55962a into RiiConnect24:master Feb 5, 2023
@malmeloo malmeloo changed the title Minor fix Fix crash when no last playing data is found Feb 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Crash when game_data.last_played is missing from API response

2 participants