[TREELIST] Fix dereferencing NULL pointer when deleting top-level item.