Fix crash when parsing malformed URLs