From f702c3adc8aea646e878fe3f4974abc0bad06040 Mon Sep 17 00:00:00 2001 From: jhnns Date: Thu, 10 Oct 2013 19:00:36 +0200 Subject: [PATCH] fix `Cannot read property '1' of null` when an issue has more than one label --- src/modules/issues.coffee | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/modules/issues.coffee b/src/modules/issues.coffee index 5c4d31d..29462d3 100644 --- a/src/modules/issues.coffee +++ b/src/modules/issues.coffee @@ -45,9 +45,14 @@ module.exports = { labels, number } = issue number ?= '?' return false unless labels - switch ( {} for { name } in labels when name and regex.test(name) ).length + # Find size labels only + size_labels = _.filter(labels, (label) -> + regex.test label.name + ) + switch size_labels.length when 0 then false when 1 + name = size_labels[0].name # Provide the size attribute on the issue. total += issue.size = parseInt name.match(regex)[1] true