Guard against empty ssdp locations (#43156)

pull/43356/head
J. Nick Koston 2020-11-12 22:40:25 -10:00 committed by Paulus Schoutsen
parent 91f265dd93
commit c37c0da191
2 changed files with 6 additions and 2 deletions

View File

@ -92,7 +92,10 @@ class Scanner:
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)
if not entries_to_process:

View File

@ -10,7 +10,7 @@ from homeassistant.components import ssdp
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."""
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_EXT: "",
}
assert "Failed to fetch ssdp data" not in caplog.text
@pytest.mark.parametrize(