«Argument 1 passed to Magento\Framework\View\Xsd\Reader::addHeadChildIntoParent() must be an instance of DOMElement, null given» (and my fix)

The erroneous core is an usual Magento 2 “friday commit”: Magento 2 team is worried about reporting “my weekly job is done” on Fridays, and commits a lot of bugs every Friday.

Frontend page load lead to the error:

Argument 1 passed to Magento\Framework\View\Xsd\Reader::addHeadChildIntoParent() must be an instance of DOMElement, null given, called in lib/internal/Magento/Framework/View/Xsd/Reader.php on line 162 and defined in lib/internal/Magento/Framework/View/Xsd/Reader.php on line 214

See the code:

To fix the bug place the following code just before the code above:

$baseXsdPath = str_replace('\\', '/', $baseXsdPath);

GitHub issue: 2082