Repository navigation
fix(events): a saved event or conditional without its id no longer stops the driver from starting - #203
Merged
Conversation
…ops the driver from starting lib/conditionals.lua and lib/events.lua looped over their saved records indexing by each one's id, so a record without one, or one that was not a table, threw "table index is nil" from OnDriverLateInit. Each loop now skips any saved entry without its id.
…, as Home Connect #114 does
Contributor
There was a problem hiding this comment.
Approving. The three guards cover every loop that indexes by a saved record's id at start-up, and Select on a string record returns nil, so the not-a-table case is skipped too. events.lua and conditionals.lua are byte-identical to Home Connect #114's head. I ran make render-checks NAME=default and mutation-tested the new test against the rendered driver. Reverting events.lua, conditionals.lua, or only the restoreEvents guard each fails it, so every guard is pinned.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
At start-up,
lib/events.luarestores the saved events, and both it andlib/conditionals.lualook for the next free id. Each of those loops indexed a table by each saved record's id. A record saved without one threw "table index is nil" fromOnDriverLateInit, and the driver never finished starting. Two Home Connect controllers in the field hit this through a saved conditional.What I changed:
Each driver picks this up on its next
copier update.