diff --git a/homeassistant/core.py b/homeassistant/core.py index 496bb018fbd..187dfcf1b83 100644 --- a/homeassistant/core.py +++ b/homeassistant/core.py @@ -1079,6 +1079,8 @@ class Config(object): def is_allowed_path(self, path: str) -> bool: """Check if the path is valid for access from outside.""" + assert path is not None + parent = pathlib.Path(path).parent try: parent = parent.resolve() # pylint: disable=no-member diff --git a/tests/test_core.py b/tests/test_core.py index 1d22d17f996..b7d049cb747 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -833,6 +833,9 @@ class TestConfig(unittest.TestCase): for path in unvalid: assert not self.config.is_allowed_path(path) + with self.assertRaises(AssertionError): + self.config.is_allowed_path(None) + @patch('homeassistant.core.monotonic') def test_create_timer(mock_monotonic, loop):