summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschneefux <schneefux+commit@schneefux.xyz>2017-04-08 22:40:00 +0200
committerschneefux <schneefux+commit@schneefux.xyz>2017-04-08 22:40:00 +0200
commit0ea2b4455a94e4e3cdc85f669e05832428e98d10 (patch)
tree03911e2056966bf1f7faff651a4a9535e6904a4e
parentffb7f592a52724b8726bcf71b1ecaf528d9faf95 (diff)
downloadprocessor-0ea2b4455a94e4e3cdc85f669e05832428e98d10.tar.gz
processor-0ea2b4455a94e4e3cdc85f669e05832428e98d10.zip
fix crash with empty rosters
-rw-r--r--worker.js5
1 files changed, 4 insertions, 1 deletions
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;