Skip to content

ValorantRank: images field is null sometimes. #2

@Peashooter101

Description

@Peashooter101

Problem

Sometimes (not often) the ValorantRank fails to have an internal Images class, sometimes this is set to null.

  • This should not occur on a status 200 response, the behavior is unexpected.

The command used was /valorant profile user:Peashooter101#7016

  • The resulting command fails since this is an unhandled exception.

Expected Values

The URL to retrieve data on user Peashooter101#7016 is https://api.henrikdev.xyz/valorant/v2/mmr/na/Peashooter101/7016 .

The following JSON is the output received using Henrik's tool found here: https://docs.henrikdev.xyz/valorant.html

On a 200 HTTP Status Code, this is the expected return value for Peashooter101#7016...

The by_season field was removed from this paste as it is not relevant to the issue and, as of right now, is ignored by the ObjectMapper.

{
  "status": 200,
  "data": {
    "name": "Peashooter101",
    "tag": "7016",
    "puuid": "7bc539b0-e68f-51f5-98bd-5377a9e2c50a",
    "current_data": {
      "currenttier": 14,
      "currenttierpatched": "Gold 3",
      "images": {
        "small": "https://media.valorant-api.com/competitivetiers/03621f52-342b-cf4e-4f86-9350a49c6d04/14/smallicon.png",
        "large": "https://media.valorant-api.com/competitivetiers/03621f52-342b-cf4e-4f86-9350a49c6d04/14/largeicon.png",
        "triangle_down": "https://media.valorant-api.com/competitivetiers/03621f52-342b-cf4e-4f86-9350a49c6d04/14/ranktriangledownicon.png",
        "triangle_up": "https://media.valorant-api.com/competitivetiers/03621f52-342b-cf4e-4f86-9350a49c6d04/14/ranktriangleupicon.png"
      },
      "ranking_in_tier": 64,
      "mmr_change_to_last_game": 30,
      "elo": 1164,
      "games_needed_for_rating": 1,
      "old": false
    },
    "by_season": { }
  }
}

Error

Console Error and Stacktrace
20:36:49.455 JDA MainWS-ReadThread                         JDA             ERROR  One of the EventListeners had an uncaught exception
java.lang.NullPointerException: Cannot read field "large" because "rankData.current_data.images" is null
        at com.Peashooter101.jaredvm.listeners.command.ValorantListener.profile(ValorantListener.java:113)
        at com.Peashooter101.jaredvm.listeners.command.ValorantListener.onSlashCommandInteraction(ValorantListener.java:40)
        at net.dv8tion.jda.api.hooks.ListenerAdapter.onEvent(ListenerAdapter.java:382)
        at net.dv8tion.jda.api.hooks.InterfacedEventManager.handle(InterfacedEventManager.java:96)
        at net.dv8tion.jda.internal.hooks.EventManagerProxy.handleInternally(EventManagerProxy.java:88)
        at net.dv8tion.jda.internal.hooks.EventManagerProxy.handle(EventManagerProxy.java:70)
        at net.dv8tion.jda.internal.JDAImpl.handleEvent(JDAImpl.java:170)
        at net.dv8tion.jda.internal.handle.InteractionCreateHandler.handleCommand(InteractionCreateHandler.java:109)
        at net.dv8tion.jda.internal.handle.InteractionCreateHandler.handleInternally(InteractionCreateHandler.java:80)
        at net.dv8tion.jda.internal.handle.SocketHandler.handle(SocketHandler.java:39)
        at net.dv8tion.jda.internal.requests.WebSocketClient.onDispatch(WebSocketClient.java:953)
        at net.dv8tion.jda.internal.requests.WebSocketClient.onEvent(WebSocketClient.java:840)
        at net.dv8tion.jda.internal.requests.WebSocketClient.handleEvent(WebSocketClient.java:818)
        at net.dv8tion.jda.internal.requests.WebSocketClient.onBinaryMessage(WebSocketClient.java:992)
        at com.neovisionaries.ws.client.ListenerManager.callOnBinaryMessage(ListenerManager.java:385)
        at com.neovisionaries.ws.client.ReadingThread.callOnBinaryMessage(ReadingThread.java:276)
        at com.neovisionaries.ws.client.ReadingThread.handleBinaryFrame(ReadingThread.java:996)
        at com.neovisionaries.ws.client.ReadingThread.handleFrame(ReadingThread.java:755)
        at com.neovisionaries.ws.client.ReadingThread.main(ReadingThread.java:108)
        at com.neovisionaries.ws.client.ReadingThread.runMain(ReadingThread.java:64)
        at com.neovisionaries.ws.client.WebSocketThread.run(WebSocketThread.java:45)

Possible considerations...

  • Jackson API ObjectMapper failed to map the objects.
  • Henrik API provided a nulled images field.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions