瀏覽代碼

Mr stupid..

David Catuhe 5 年之前
父節點
當前提交
6b9f08b6d6
共有 1 個文件被更改,包括 3 次插入0 次删除
  1. 3 0
      src/Misc/stringTools.ts

+ 3 - 0
src/Misc/stringTools.ts

@@ -19,6 +19,9 @@ export class StringTools {
      * @returns Boolean indicating whether the suffix was found (true) or not (false)
      * @returns Boolean indicating whether the suffix was found (true) or not (false)
      */
      */
     public static StartsWith(str: string, suffix: string): boolean {
     public static StartsWith(str: string, suffix: string): boolean {
+        if (!str) {
+            return false;
+        }
         return str.indexOf(suffix) === 0;
         return str.indexOf(suffix) === 0;
     }
     }