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.
Fix crash caused by repeatedly cloning the same path hierarchy node #1220
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
base: main
Are you sure you want to change the base?
Fix crash caused by repeatedly cloning the same path hierarchy node #1220
Changes from all commits
e161b2a
ddbf6d5
70b5a11
12fce59
4187f62
c12c7d1
a4cbe18
af2170d
1833f6c
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
accessing parents.children without checking parens exists, may be the check is somewhere else ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand at al what this comment is referring to. The parent is not optional so it doesn't make any sense to check if it's
nil
. The compiler already guarantees that and trying to check using eitherif let
or optional chaining would introduce a compiler error.The only unwrapped optional value on this line of code is
components.first!
but that's not mentioned in your comment. Besides, it's safe to access the first element of the components array because this line of code is inside a loop over the components. If the execution enters the loop body it's because the components is non-empty (which makes it perfectly safe to unwrap the first component).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"accessing parents.children" I meant accessing its element by a specific value, and it is "components.first!" Yes you are right I didn't mention that but that's what I meant. I am just use to not using "!" whenever possible and hence my comment. I understand it would be safe to access it considering where it is used inside the loop over the components.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this index be using
component
instead ofcomponents.first!
? It just looks like we're checking the first path component over and over instead of actually looking for successive children of the parent. Ditto for the assertion underneath this block, which i edited in #1212.