Don't x_node_set on a tree which doesn't exist #1657
Merged
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.
Calling
x_node_set
when a tree doesn't exist works, but actually creates the entry thattree_exists?
checks to see if such a tree exists.When the user doesn't have the right to see such a tree, that's problematic, since it breaks the assumption that
tree_exists?
returns true only for trees that were actually initialized.That leads to calling
lock_tree
on a nonexistent tree, leading to a JS exceptions ("No element has been found").This makes us actually check if the tree already exists before calling
x_node_set
on it - specifically forroles_tree
(that'sTreeBuilderReportRoles
).(I would prefer to fix
x_node_set
instead, but.. this is a bugfix, and I really don't want to introduce more bugs. :))https://bugzilla.redhat.com/show_bug.cgi?id=1467146
EDIT: also fixes https://bugzilla.redhat.com/show_bug.cgi?id=1448332