From af6e31b3444d090816e5c64e5827cd2271bc8bb3 Mon Sep 17 00:00:00 2001 From: marcandre Date: Thu, 1 Apr 2010 18:03:15 +0000 Subject: [PATCH] * lib/matrix.rb (empty): Reject negative sizes git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27157 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/matrix.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/matrix.rb b/lib/matrix.rb index 6227c435bf..f9c379509d 100644 --- a/lib/matrix.rb +++ b/lib/matrix.rb @@ -241,7 +241,8 @@ class Matrix # => Matrix[[0, 0, 0], [0, 0, 0]] # def Matrix.empty(row_size = 0, column_size = 0) - Matrix.Raise ErrDimensionMismatch if column_size != 0 && row_size != 0 + Matrix.Raise ArgumentError, "One size must be 0" if column_size != 0 && row_size != 0 + Matrix.Raise ArgumentError, "Negative size" if column_size < 0 || row_size < 0 new([[]]*row_size, column_size) end