Description
I have TreeTable with some nodes, perform some filtering of them and update tree model. If result of filtering is nothing (empty Tree) I set setRoot(null) on the tree model. This send treeStructureChanged event to all listeners (to my TreeTable) with parameter TreeModelEvent which is constructed with null TreePath parameter. This cause NullPointerException in AbstractTree (implements TreeModelListener).
I propose this fix:
org.apache.wicket.markup.html.tree.AbstractTree
/**
- @see javax.swing.event.TreeModelListener#treeStructureChanged(javax.swing.event.TreeModelEvent)
*/
public final void treeStructureChanged(TreeModelEvent e)
{
// empty root
if(e.getTreePath() == null) { invalidateAll(); }
else {
// get the parent node of changed nodes
TreeNode node = (TreeNode)e.getTreePath().getLastPathComponent();
// has the tree root changed?
if (e.getTreePath().getPathCount() == 1 && node.equals(rootItem.getModelObject()))
else
{ invalidateNodeWithChildren(node); } }
}