Revision: 3607 http://trac.macosforge.org/projects/ruby/changeset/3607 Author: lsansonetti@apple.com Date: 2010-02-24 15:05:40 -0800 (Wed, 24 Feb 2010) Log Message: ----------- honor invalid/empty groups Modified Paths: -------------- MacRuby/branches/icu/re.cpp Modified: MacRuby/branches/icu/re.cpp =================================================================== --- MacRuby/branches/icu/re.cpp 2010-02-24 22:46:02 UTC (rev 3606) +++ MacRuby/branches/icu/re.cpp 2010-02-24 23:05:40 UTC (rev 3607) @@ -1212,9 +1212,12 @@ } const int beg = RMATCH(match)->results[nth].beg; - const int len = RMATCH(match)->results[nth].end - beg; + const int end = RMATCH(match)->results[nth].end; + if (beg == -1 || end == -1) { + return Qnil; + } - return unistr_subseq(RMATCH(match)->unistr, beg, len); + return unistr_subseq(RMATCH(match)->unistr, beg, end - beg); } VALUE
participants (1)
-
source_changes@macosforge.org