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(">", ">"); } }