fix: Fix infinite loop when only one selection exists.