ui_qt: fix crash if user selects the first line