From ef6a57ea9bf45b4cd989582e13f7f891d2777396 Mon Sep 17 00:00:00 2001 From: Aditya Kulkarni Date: Thu, 11 Jul 2019 13:20:15 -0700 Subject: [PATCH] #157 - Prevent crash if there's no selection --- src/addressbook.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/addressbook.cpp b/src/addressbook.cpp index d8ceccd..7ec64cb 100644 --- a/src/addressbook.cpp +++ b/src/addressbook.cpp @@ -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); }