Revision
3790
Author
lsansonetti@apple.com
Date
2010-03-17 18:34:30 -0700 (Wed, 17 Mar 2010)

Log Message

fixed another minor bug in rb_reg_regsub()

Modified Paths

Diff

Modified: MacRuby/trunk/string.c (3789 => 3790)


--- MacRuby/trunk/string.c	2010-03-18 01:07:57 UTC (rev 3789)
+++ MacRuby/trunk/string.c	2010-03-18 01:34:30 UTC (rev 3790)
@@ -3187,6 +3187,9 @@
 	if (c != '\\') {
 	    continue;
 	}
+	if (i + 1 == str_chars_len) {
+	    break;
+	}
 
 	if (val == 0) {
 	    val = rb_unicode_str_new(NULL, 0);
@@ -3194,9 +3197,6 @@
 	str_concat_uchars(RSTR(val), &str_chars[pos], i - pos);
 
 	i++;
-	if (i == str_chars_len) {
-	    break;
-	}
 	pos = i + 1;
 
 	int no = -1;