Browse Source

throw exception if EReg.matched is used without previously matching (fixed issue #1474)

Simon Krajewski 12 years ago
parent
commit
88df51cff9
1 changed files with 1 additions and 1 deletions
  1. 1 1
      std/php/_std/EReg.hx

+ 1 - 1
std/php/_std/EReg.hx

@@ -50,7 +50,7 @@
 	}
 
 	public function matched( n : Int ) : String {
-		if ( n < 0 ) throw "EReg::matched";
+		if (matches == null ||  n < 0 ) throw "EReg::matched";
 		// we can't differenciate between optional groups at the end of a match
 		// that have not been matched and invalid groups
 		if( n >= untyped __call__("count", matches)) return null;