#157 - Prevent crash if there's no selection

This commit is contained in:
Aditya Kulkarni
2019-07-11 13:20:15 -07:00
parent 11c14d9af1
commit ef6a57ea9b

View File

@@ -217,7 +217,7 @@ void AddressBook::open(MainWindow* parent, QLineEdit* target) {
if (d.exec() == QDialog::Accepted && target != nullptr) {
auto selection = ab.addresses->selectionModel();
if (selection->hasSelection()) {
if (selection && selection->hasSelection() && selection->selectedRows().size() > 0) {
auto item = model.itemAt(selection->selectedRows().at(0).row());
fnSetTargetLabelAddr(target, item.first, item.second);
}