cpp: Add safety checks for key update
* lang/cpp/src/key.cpp (Key::update): Check that the key is not NULL. * lang/cpp/src/verificationresult.cpp (GpgME::Signature::key): Check for fingerprint.
This commit is contained in:
parent
4d1642b11e
commit
a6e5c8bf18
@ -347,6 +347,9 @@ const Key &Key::mergeWith(const Key &other)
|
||||
|
||||
void Key::update()
|
||||
{
|
||||
if (isNull() || !primaryFingerprint()) {
|
||||
return;
|
||||
}
|
||||
auto ctx = Context::createForProtocol(protocol());
|
||||
if (!ctx) {
|
||||
return;
|
||||
|
@ -406,7 +406,7 @@ GpgME::Key GpgME::Signature::key(bool search, bool update) const
|
||||
}
|
||||
|
||||
GpgME::Key ret = key();
|
||||
if (ret.isNull() && search) {
|
||||
if (ret.isNull() && search && fingerprint ()) {
|
||||
auto ctx = Context::createForProtocol (d->proto);
|
||||
if (ctx) {
|
||||
ctx->setKeyListMode(KeyListMode::Local |
|
||||
|
Loading…
Reference in New Issue
Block a user