Guard against empty ssdp locations (#43156)
This commit is contained in:
parent
91f265dd93
commit
c37c0da191
2 changed files with 6 additions and 2 deletions
|
@ -92,7 +92,10 @@ class Scanner:
|
||||||
|
|
||||||
entries_to_process.append(entry)
|
entries_to_process.append(entry)
|
||||||
|
|
||||||
if entry.location not in self._description_cache:
|
if (
|
||||||
|
entry.location is not None
|
||||||
|
and entry.location not in self._description_cache
|
||||||
|
):
|
||||||
unseen_locations.add(entry.location)
|
unseen_locations.add(entry.location)
|
||||||
|
|
||||||
if not entries_to_process:
|
if not entries_to_process:
|
||||||
|
|
|
@ -10,7 +10,7 @@ from homeassistant.components import ssdp
|
||||||
from tests.common import mock_coro
|
from tests.common import mock_coro
|
||||||
|
|
||||||
|
|
||||||
async def test_scan_match_st(hass):
|
async def test_scan_match_st(hass, caplog):
|
||||||
"""Test matching based on ST."""
|
"""Test matching based on ST."""
|
||||||
scanner = ssdp.Scanner(hass, {"mock-domain": [{"st": "mock-st"}]})
|
scanner = ssdp.Scanner(hass, {"mock-domain": [{"st": "mock-st"}]})
|
||||||
|
|
||||||
|
@ -38,6 +38,7 @@ async def test_scan_match_st(hass):
|
||||||
ssdp.ATTR_SSDP_SERVER: "mock-server",
|
ssdp.ATTR_SSDP_SERVER: "mock-server",
|
||||||
ssdp.ATTR_SSDP_EXT: "",
|
ssdp.ATTR_SSDP_EXT: "",
|
||||||
}
|
}
|
||||||
|
assert "Failed to fetch ssdp data" not in caplog.text
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue