From f396d586632510e6020698bbd54c8fd4ff88628e Mon Sep 17 00:00:00 2001 From: metheglin Date: Tue, 13 Dec 2016 19:11:56 +0900 Subject: [PATCH] Check existence of the index of array. --- lib/histogram.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/histogram.rb b/lib/histogram.rb index eb095cb..546d3f1 100644 --- a/lib/histogram.rb +++ b/lib/histogram.rb @@ -343,7 +343,7 @@ def histogram(*args) if index == bins index -= 1 end - _freqs[index] += height + _freqs[index] += height if _freqs[index] end _freqs end