浏览代码

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

Simon Krajewski 12 年之前
父节点
当前提交
88df51cff9
共有 1 个文件被更改,包括 1 次插入1 次删除
  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;