Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Skill Icon nullable. #118

Merged
merged 1 commit into from
Apr 9, 2022
Merged

Make Skill Icon nullable. #118

merged 1 commit into from
Apr 9, 2022

Conversation

dlamkins
Copy link
Contributor

@dlamkins dlamkins commented Apr 8, 2022

Some skills appear to have no icon returned by the API.

For example: https://api.guildwars2.com/v2/skills?ids=52116

[
  {
    "name": "Largos' Domain",
    "facts": [
      {
        "text": "Recharge",
        "type": "Recharge",
        "icon": "https://render.guildwars2.com/file/D767B963D120F077C3B163A05DC05A7317D7DB70/156651.png",
        "value": 2
      },
      {
        "text": "Apply Buff/Condition",
        "type": "Buff",
        "icon": "https://render.guildwars2.com/file/FB5C627D1A6A46807AF77165604A27FE804B056F/2039793.png",
        "duration": 20,
        "status": "Waterlogged",
        "description": "As you become more waterlogged, you become more susceptible to the largos' water magic. If you become fully waterlogged at maximum stacks, you will be assassinated.",
        "apply_count": 1
      }
    ],
    "description": "",
    "flags": [],
    "id": 52116,
    "chat_link": "[&BpTLAAA=]"
  }
]

When the Skill Icon property isn't nullable, checking if it's != "" will throw a NRE because the implicit cast to a string attempts to access the Url property which is null because the struct was default. If nullable, then it won't be default and the issue is avoided.

Make Skill Icon nullable.
@Archomeda Archomeda merged commit f0461e4 into Archomeda:master Apr 9, 2022
@Archomeda Archomeda added Type: Bug Something isn't working Area: Web API v2 Related to the v2 web API labels May 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Web API v2 Related to the v2 web API Type: Bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants