Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #136 from daptiv/issue120

Fixed NullRef, serialized DTO can be null
  • Loading branch information...
commit cba794d187d75f7c23e539f4d71a9a86c2c0172a 2 parents 9e24486 + 7268868
@mythz mythz authored
Showing with 2 additions and 1 deletion.
  1. +2 −1  src/ServiceStack/WebHost.EndPoints/Formats/HtmlFormat.cs
View
3  src/ServiceStack/WebHost.EndPoints/Formats/HtmlFormat.cs
@@ -41,7 +41,8 @@ public void SerializeToStream(IRequestContext requestContext, object dto, IHttpR
&& httpReq.ResponseContentType != ContentType.JsonReport) return;
// Serialize then escape any potential script tags to avoid XSS when displaying as HTML
- var json = JsonSerializer.SerializeToString(dto).Replace("<", "&lt;").Replace(">", "&gt;");
+ var json = JsonSerializer.SerializeToString(dto) ?? "null";
+ json = json.Replace("<", "&lt;").Replace(">", "&gt;");
var url = httpReq.AbsoluteUri
.Replace("format=html", "")
Please sign in to comment.
Something went wrong with that request. Please try again.