Fixes a null reference usage

main
Paul Schneider 9 years ago
parent 8b97ed23d2
commit a73744bd47
1 changed files with 14 additions and 1 deletions

@ -39,7 +39,7 @@ namespace Yavsc.Helpers
} }
public string Execute(string source) public string Execute(string source)
{ {
return source.Replace(target, replacement); return source?.Replace(target, replacement) ?? null;
} }
} }
public static class TeXHelpers public static class TeXHelpers
@ -79,6 +79,19 @@ namespace Yavsc.Helpers
} }
return new TeXString(result); return new TeXString(result);
} }
public static TeXString ToTeXCell(this string source)
{
string result=source;
foreach (var r in SpecialCharsDefaultRendering)
{
result = r.Execute(result);
}
result = result.Replace("\n","\\tabularnewline ");
return new TeXString(result);
}
public static string NewLinesWith(this string target, string separator) public static string NewLinesWith(this string target, string separator)
{ {
var items = target.Split(new char[] { '\n' }).Where( var items = target.Split(new char[] { '\n' }).Where(

Loading…