Fixed thrown errors when selection has no nodes.