core: don't try to deserialize an empty extra to remove a field

This commit is contained in:
moneromooo-monero 2017-01-07 16:05:02 +00:00
parent ab69d5b367
commit 64da0983d5
No known key found for this signature in database
GPG key ID: 686F07454D6CEFC3

View file

@ -371,6 +371,8 @@ namespace cryptonote
//--------------------------------------------------------------- //---------------------------------------------------------------
bool remove_field_from_tx_extra(std::vector<uint8_t>& tx_extra, const std::type_info &type) bool remove_field_from_tx_extra(std::vector<uint8_t>& tx_extra, const std::type_info &type)
{ {
if (tx_extra.empty())
return true;
std::string extra_str(reinterpret_cast<const char*>(tx_extra.data()), tx_extra.size()); std::string extra_str(reinterpret_cast<const char*>(tx_extra.data()), tx_extra.size());
std::istringstream iss(extra_str); std::istringstream iss(extra_str);
binary_archive<false> ar(iss); binary_archive<false> ar(iss);