summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authormarcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-04-01 18:03:15 +0000
committermarcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-04-01 18:03:15 +0000
commitaf6e31b3444d090816e5c64e5827cd2271bc8bb3 (patch)
tree1e8f14fd5c9e8dc3ee13f18dce29f60f85287686 /lib
parentfac245828b9e354c9eeb93a029f1643031c3c62d (diff)
* lib/matrix.rb (empty): Reject negative sizes
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27157 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/matrix.rb3
1 files changed, 2 insertions, 1 deletions
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