From b9f3b2ebb4c3e823ba60e9e788824964f4ca3354 Mon Sep 17 00:00:00 2001
From: Wizou <11647984+wiz0u@users.noreply.github.com>
Date: Sun, 25 Feb 2024 12:46:20 +0100
Subject: [PATCH] text Escape methods accept null
---
src/TL.Extensions.cs | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/TL.Extensions.cs b/src/TL.Extensions.cs
index 96fb1af..26986a0 100644
--- a/src/TL.Extensions.cs
+++ b/src/TL.Extensions.cs
@@ -254,6 +254,7 @@ namespace TL
/// The escaped text, ready to be used in MarkdownToEntities without problems
public static string Escape(string text)
{
+ if (text == null) return null;
StringBuilder sb = null;
for (int index = 0, added = 0; index < text.Length; index++)
{
@@ -445,6 +446,6 @@ namespace TL
/// The text to make HTML-safe
/// The HTML-safe text, ready to be used in HtmlToEntities without problems
public static string Escape(string text)
- => text.Replace("&", "&").Replace("<", "<").Replace(">", ">");
+ => text?.Replace("&", "&").Replace("<", "<").Replace(">", ">");
}
}