Checks during node move

Without this check, when an ancestor is dragged onto a descendant, the whole tree vanishes.