Revision: 3775 http://trac.macosforge.org/projects/ruby/changeset/3775 Author: martinlagardette@apple.com Date: 2010-03-16 16:07:41 -0700 (Tue, 16 Mar 2010) Log Message: ----------- #rindex: don't lookup param in an empty array - Fixes 7692217 Modified Paths: -------------- MacRuby/trunk/array.c Modified: MacRuby/trunk/array.c =================================================================== --- MacRuby/trunk/array.c 2010-03-16 22:41:08 UTC (rev 3774) +++ MacRuby/trunk/array.c 2010-03-16 23:07:41 UTC (rev 3775) @@ -896,10 +896,12 @@ else { VALUE val; rb_scan_args(argc, argv, "01", &val); - - size_t pos = rary_rindex_of_item(ary, RARY(ary)->len - 1, val); - if (pos != NOT_FOUND) { - return LONG2NUM(pos); + + if (RARY(ary)->len > 0) { + size_t pos = rary_rindex_of_item(ary, RARY(ary)->len - 1, val); + if (pos != NOT_FOUND) { + return LONG2NUM(pos); + } } } return Qnil;