Permalink
Browse files

Fixed NullRef, serialized DTO can be null

  • Loading branch information...
1 parent 9e24486 commit 7268868f7a9e095ac76bd3f9b546665cd8282e6e @sneal sneal committed Apr 14, 2012
Showing with 2 additions and 1 deletion.
  1. +2 −1 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", "")

0 comments on commit 7268868

Please sign in to comment.