Explorar o código

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

Simon Krajewski %!s(int64=12) %!d(string=hai) anos
pai
achega
88df51cff9
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  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;