Browse Source

LibWeb: Fix crash in XMLHttpRequest::response_xml() if response empty

If response object is empty we should return nullptr.

Fixes crash on https://store.steampowered.com/
Aliaksandr Kalenik 1 năm trước cách đây
mục cha
commit
09c1eccb50
1 tập tin đã thay đổi với 2 bổ sung0 xóa
  1. 2 0
      Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp

+ 2 - 0
Userland/Libraries/LibWeb/XHR/XMLHttpRequest.cpp

@@ -144,6 +144,8 @@ WebIDL::ExceptionOr<JS::GCPtr<DOM::Document>> XMLHttpRequest::response_xml()
     set_document_response();
 
     // 6. Return this’s response object.
+    if (m_response_object.has<Empty>())
+        return nullptr;
     return &verify_cast<DOM::Document>(m_response_object.get<JS::Value>().as_object());
 }