ncurses: fix crash after deleting last item