Skip to content

Commit

Permalink
Merge pull request #2833 from sbwalker/dev
Browse files Browse the repository at this point in the history
add null check
  • Loading branch information
sbwalker authored May 23, 2023
2 parents d13f26d + 452d0af commit 31907f2
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions Oqtane.Client/UI/ThemeBuilder.razor
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,18 @@

private string AddHeadContent(string headcontent, string content)
{
// format head content, remove scripts, and filter duplicate elements
var elements = (">" + content.Replace("\n", "") + "<").Split("><");
foreach (var element in elements)
if (!string.IsNullOrEmpty(content))
{
if (!string.IsNullOrEmpty(element) && !element.Contains("script"))
// format head content, remove scripts, and filter duplicate elements
var elements = (">" + content.Replace("\n", "") + "<").Split("><");
foreach (var element in elements)
{
if (!headcontent.Contains("<" + element + ">"))
if (!string.IsNullOrEmpty(element) && !element.Contains("script"))
{
headcontent += "<" + element + ">" + "\n";
if (!headcontent.Contains("<" + element + ">"))
{
headcontent += "<" + element + ">" + "\n";
}
}
}
}
Expand Down

0 comments on commit 31907f2

Please sign in to comment.