Explorar el Código

commit: fix null reference

HOME hace 5 años
padre
commit
9b1b844f3d
Se han modificado 1 ficheros con 8 adiciones y 1 borrados
  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;