mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-15 06:32:31 +00:00
Merge pull request #748 from pyroscope/d_custom_if_z-empty-val
d.custom.if_z: return default also for existing but empty value
This commit is contained in:
@@ -286,7 +286,8 @@ retrieve_d_custom_if_z(core::Download* download, const torrent::Object::list_typ
|
||||
throw torrent::bencode_error("d.custom.if_z: Missing default argument.");
|
||||
|
||||
try {
|
||||
return download->bencode()->get_key("rtorrent").get_key("custom").get_key_string(key);
|
||||
const std::string& val = download->bencode()->get_key("rtorrent").get_key("custom").get_key_string(key);
|
||||
return val.empty() ? itr->as_string() : val;
|
||||
} catch (torrent::bencode_error& e) {
|
||||
return itr->as_string();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user