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

View file

@ -111,7 +111,12 @@ class Config(OrderedDict, fv.FinalValidateConfig):
last_root = max( last_root = max(
i for i, v in enumerate(error.path) if v is cv.ROOT_CONFIG_PATH 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) self.errors.append(error)
def add_validation_step(self, step: "ConfigValidationStep"): def add_validation_step(self, step: "ConfigValidationStep"):