From 0ea2b4455a94e4e3cdc85f669e05832428e98d10 Mon Sep 17 00:00:00 2001 From: schneefux Date: Sat, 8 Apr 2017 22:40:00 +0200 Subject: fix crash with empty rosters --- worker.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/worker.js b/worker.js index 30d885b..09e2347 100644 --- a/worker.js +++ b/worker.js @@ -138,7 +138,10 @@ var RABBITMQ_URI = process.env.RABBITMQ_URI, roster.attributes.shardId = match.attributes.shardId; roster.createdAt = match.createdAt; // TODO API workaround: roster does not have `winner` - roster.attributes.stats.winner = roster.participants[0].stats.winner; + if (roster.participants.length > 0) + roster.attributes.stats.winner = roster.participants[0].stats.winner; + else // Blitz 2v0, see 095e86e4-1bd3-11e7-b0b1-0297c91b7699 on eu + roster.attributes.stats.winner = false; roster.participants = roster.participants.map((participant) => { participant.attributes.shardId = roster.attributes.shardId; -- cgit v1.3.1