Browse Source

[hl] fixed UnicodeString.substr() for `null` len

Aleksandr Kuzmenko 6 years ago
parent
commit
1442049f79
1 changed files with 7 additions and 6 deletions
  1. 7 6
      std/UnicodeString.hx

+ 7 - 6
std/UnicodeString.hx

@@ -315,13 +315,14 @@ abstract UnicodeString(String) from String to String {
 				pos = 0;
 			}
 		}
-		if(len < 0) {
-			len = (this:UnicodeString).length + len;
-		}
-		if(len <= 0) {
-			return "";
+		if(len != null) {
+			if(len < 0) {
+				len = (this:UnicodeString).length + len;
+			}
+			if(len <= 0) {
+				return "";
+			}
 		}
-
 		var unicodeOffset = 0;
 		var nativeOffset = 0;
 		var fromOffset = -1;