Fix crash when handling pin_check error (#5915)

This commit is contained in:
Clyde Stubbs 2023-12-13 10:38:37 +11:00 committed by GitHub
parent 03baaa94a8
commit 29002c8f45
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -111,7 +111,12 @@ class Config(OrderedDict, fv.FinalValidateConfig):
last_root = max(
i for i, v in enumerate(error.path) if v is cv.ROOT_CONFIG_PATH
)
error.path = error.path[last_root + 1 :]
# can't change the path so re-create the error
error = vol.Invalid(
message=error.error_message,
path=error.path[last_root + 1 :],
error_type=error.error_type,
)
self.errors.append(error)
def add_validation_step(self, step: "ConfigValidationStep"):