Skip to content

Commit

Permalink
treat undefined strings as empty
Browse files Browse the repository at this point in the history
  • Loading branch information
nhnb committed Dec 11, 2024
1 parent 178cd60 commit 4f9ffc1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/js/stendhal/util/StringUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ export namespace StringUtil {
* `true` if string length excluding whitespace characters is 0.
*/
export function isEmpty(st: string): boolean {
return st.trim().length === 0;
if (!st) {
return true;
}
return st.trim() === "";
};

/**
Expand Down

0 comments on commit 4f9ffc1

Please sign in to comment.