瀏覽代碼

Fix String.substr (pos != 0, length < 0)

Pascal Peridont 19 年之前
父節點
當前提交
1c90918d12
共有 1 個文件被更改,包括 1 次插入0 次删除
  1. 1 0
      std/js/Boot.hx

+ 1 - 0
std/js/Boot.hx

@@ -218,6 +218,7 @@ class Boot {
 			};
 			};
 			var oldsub = String.prototype.substr;
 			var oldsub = String.prototype.substr;
 			String.prototype.substr = function(pos,len){
 			String.prototype.substr = function(pos,len){
+				if( pos != null && pos != 0 && len < 0 ) return "";
 				if( pos < 0 ){
 				if( pos < 0 ){
 					pos = this.length + pos;
 					pos = this.length + pos;
 					if( pos < 0 ) pos = 0;
 					if( pos < 0 ) pos = 0;