REL-1301: Added null check to preserve the tree node selection.