Nicolas Cannasse 17 years ago
parent
commit
cfa4bdca0d
1 changed files with 2 additions and 1 deletions
  1. 2 1
      std/EReg.hx

+ 2 - 1
std/EReg.hx

@@ -113,7 +113,8 @@ class EReg {
 	**/
 	**/
 	public function matched( n : Int ) : String {
 	public function matched( n : Int ) : String {
 		#if neko
 		#if neko
-			return new String(regexp_matched(r,n));
+			var m = regexp_matched(r,n);
+			return (m == null) ? null : new String(m);
 		#elseif js
 		#elseif js
 			return untyped if( r.m != null && n >= 0 && n < r.m.length ) r.m[n] else throw "EReg::matched";
 			return untyped if( r.m != null && n >= 0 && n < r.m.length ) r.m[n] else throw "EReg::matched";
 		#elseif flash9
 		#elseif flash9