diff --git a/c/opendht.cpp b/c/opendht.cpp index 58a7db343955303264d7d0681d44bff340da6349..cfd05570fcab65581c8940b0d993da429367f63e 100644 --- a/c/opendht.cpp +++ b/c/opendht.cpp @@ -84,7 +84,7 @@ dht_value_id dht_value_get_id(const dht_value* data) { dht_publickey* dht_value_get_owner(const dht_value* data) { const ValueSp& vsp(*reinterpret_cast<const ValueSp*>(data)); - return reinterpret_cast<dht_publickey*>(new PubkeySp(vsp->owner)); + return vsp->owner ? reinterpret_cast<dht_publickey*>(new PubkeySp(vsp->owner)) : nullptr; } dht_infohash dht_value_get_recipient(const dht_value* data) {