Bug #1518: Matrix#[] Raises NoMethodError for Invalid Index http://redmine.ruby-lang.org/issues/show/1518 Author: Run Paint Run Run Status: Open, Priority: Normal ruby -v: ruby 1.8.7 (2008-08-11 patchlevel 72) [i486-linux] / ruby 1.9.0 (2008-06-20 revision 17482) [i486-linux] >> m = Matrix[[0, 1, 2], [3, 4, 5], [6, 7, 8], [9, 10, 11]] >> m[2,8] => nil >> m[8,2] NoMethodError: undefined method `[]' for nil:NilClass from /usr/lib/ruby/1.9.0/matrix.rb:264:in `[]' from (irb):13 from /usr/bin/irb1.9:12:in `<main>' The #[] accessor for Matrix raises a particularly disconcerting NoMethodError when its passed an index which is out of bounds for the second argument. To be consistent with itself, it should return nil when either index is invalid. ---------------------------------------- http://redmine.ruby-lang.org