cpp: Fix init of string from null
* lang/cpp/src/key.cpp (UserID::addrSpecFromString): Check return value before creating the string.
This commit is contained in:
parent
f526d0e22e
commit
1e8c34a919
@ -884,9 +884,12 @@ std::string UserID::addrSpecFromString(const char *userid)
|
|||||||
return std::string();
|
return std::string();
|
||||||
}
|
}
|
||||||
char *normalized = gpgme_addrspec_from_uid (userid);
|
char *normalized = gpgme_addrspec_from_uid (userid);
|
||||||
|
if (normalized) {
|
||||||
std::string ret(normalized);
|
std::string ret(normalized);
|
||||||
gpgme_free(normalized);
|
gpgme_free(normalized);
|
||||||
return ret;
|
return ret;
|
||||||
|
}
|
||||||
|
return std::string();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string UserID::addrSpec() const
|
std::string UserID::addrSpec() const
|
||||||
|
Loading…
Reference in New Issue
Block a user