diff options
| author | schneefux <schneefux+commit@schneefux.xyz> | 2017-04-08 22:40:00 +0200 |
|---|---|---|
| committer | schneefux <schneefux+commit@schneefux.xyz> | 2017-04-08 22:40:00 +0200 |
| commit | 0ea2b4455a94e4e3cdc85f669e05832428e98d10 (patch) | |
| tree | 03911e2056966bf1f7faff651a4a9535e6904a4e | |
| parent | ffb7f592a52724b8726bcf71b1ecaf528d9faf95 (diff) | |
| download | shrinker-0ea2b4455a94e4e3cdc85f669e05832428e98d10.tar.gz shrinker-0ea2b4455a94e4e3cdc85f669e05832428e98d10.zip | |
fix crash with empty rosters
| -rw-r--r-- | worker.js | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -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; |
