Skip to content

Commit

Permalink
fix null handling in encoding helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
KurtGokhan committed Feb 17, 2024
1 parent 6cc693c commit 5bdbcd3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Runtime/Scripting/DomProxies/EncodingHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public static class EncodingHelpers

public static string encodeURI(string input)
{
if (input == null) return "";
var len = input.Length;
if (len < EscapeLimit) return Uri.EscapeUriString(input);

Expand All @@ -24,11 +25,13 @@ public static string encodeURI(string input)

public static string decodeURI(string input)
{
if (input == null) return "";
return Uri.UnescapeDataString(input);
}

public static string encodeURIComponent(string input)
{
if (input == null) return "";
var len = input.Length;
if (len < EscapeLimit) return Uri.EscapeDataString(input);

Expand All @@ -43,6 +46,7 @@ public static string encodeURIComponent(string input)

public static string decodeURIComponent(string input)
{
if (input == null) return "";
return Uri.UnescapeDataString(input);
}
}
Expand Down

0 comments on commit 5bdbcd3

Please sign in to comment.