Browse Source

commit: fix null reference

HOME 4 years ago
parent
commit
9b1b844f3d
1 changed files with 8 additions and 1 deletions
  1. 8 1
      Rac.Core/Models/Response.cs

+ 8 - 1
Rac.Core/Models/Response.cs

@@ -23,7 +23,14 @@ namespace Rac.Models
 
         public bool GetHtmlDocument(out IHtmlDocument html)
         {
-            var ct = new ContentType(ContentType);
+            var contentType = ContentType;
+            if (null == contentType)
+            {
+                html = null;
+                return false;
+            }
+
+            var ct = new ContentType(contentType);
             if (ct.MediaType != "text/html")
             {
                 html = null;