Skip to content

Commit

Permalink
Don't crash when invited to a custom game
Browse files Browse the repository at this point in the history
  • Loading branch information
molenzwiebel committed Aug 24, 2018
1 parent 188ceea commit 1e6d3cb
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions Sentinel/Sentinel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -190,15 +190,25 @@ private async void HandleInviteUpdate(dynamic dynInvites)
{
if (invite["canAcceptInvitation"] && invite["state"] == "Pending")
{
var queueInfo = await league.Get("/lol-game-queues/v1/queues/" + invite["gameConfig"]["queueId"]);
var mapInfo = await league.Get("/lol-maps/v1/map/" + queueInfo["mapId"]);
string queueName;
if ((long) invite["gameConfig"]["queueId"] == -1)
{
queueName = "Custom Game";
}
else
{
var queueInfo = await league.Get("/lol-game-queues/v1/queues/" + invite["gameConfig"]["queueId"]);
queueName = queueInfo["shortName"];
}

var mapInfo = await league.Get("/lol-maps/v1/map/" + invite["gameConfig"]["mapId"]);
var iconPath = await GetSummonerIconPath(invite["fromSummonerId"]);

NotificationManager.ShowInviteNotification(
invite["invitationId"],
iconPath,
invite["fromSummonerName"],
mapInfo["name"] + " - " + queueInfo["shortName"]
mapInfo["name"] + " - " + queueName
);
} else
{
Expand Down

0 comments on commit 1e6d3cb

Please sign in to comment.