#157 - Prevent crash if there's no selection
This commit is contained in:
@@ -217,7 +217,7 @@ void AddressBook::open(MainWindow* parent, QLineEdit* target) {
|
|||||||
|
|
||||||
if (d.exec() == QDialog::Accepted && target != nullptr) {
|
if (d.exec() == QDialog::Accepted && target != nullptr) {
|
||||||
auto selection = ab.addresses->selectionModel();
|
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());
|
auto item = model.itemAt(selection->selectedRows().at(0).row());
|
||||||
fnSetTargetLabelAddr(target, item.first, item.second);
|
fnSetTargetLabelAddr(target, item.first, item.second);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user