aboutsummaryrefslogtreecommitdiffstats
path: root/src/ui/widgets/KeyList.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/widgets/KeyList.cpp')
-rw-r--r--src/ui/widgets/KeyList.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/ui/widgets/KeyList.cpp b/src/ui/widgets/KeyList.cpp
index 429a5bd1..53adb316 100644
--- a/src/ui/widgets/KeyList.cpp
+++ b/src/ui/widgets/KeyList.cpp
@@ -507,11 +507,15 @@ void KeyList::import_keys(const QByteArray& in_buffer) {
}
auto KeyList::GetSelectedKey() -> GpgAbstractKeyPtr {
- return GetSelectedKeys().front();
+ auto k = GetSelectedKeys();
+ if (k.empty()) return nullptr;
+ return k.front();
}
auto KeyList::GetSelectedGpgKey() -> GpgKeyPtr {
- return GetSelectedGpgKeys().front();
+ auto k = GetSelectedGpgKeys();
+ if (k.empty()) return nullptr;
+ return k.front();
}
auto KeyList::GetSelectedGpgKeys() -> GpgKeyPtrList {