fix entry assignment from bdecode_node and lazy_entry

This commit is contained in:
arvidn 2019-07-20 11:00:59 -07:00 committed by Arvid Norberg
parent 057c6684f2
commit 71c980957c
1 changed files with 2 additions and 2 deletions

View File

@ -359,6 +359,7 @@ namespace {
// convert a bdecode_node into an old school entry // convert a bdecode_node into an old school entry
entry& entry::operator=(bdecode_node const& e) & entry& entry::operator=(bdecode_node const& e) &
{ {
destruct();
switch (e.type()) switch (e.type())
{ {
case bdecode_node::string_t: case bdecode_node::string_t:
@ -388,7 +389,6 @@ namespace {
break; break;
} }
case bdecode_node::none_t: case bdecode_node::none_t:
destruct();
break; break;
} }
return *this; return *this;
@ -398,6 +398,7 @@ namespace {
// convert a lazy_entry into an old school entry // convert a lazy_entry into an old school entry
entry& entry::operator=(lazy_entry const& e) & entry& entry::operator=(lazy_entry const& e) &
{ {
destruct();
switch (e.type()) switch (e.type())
{ {
case lazy_entry::string_t: case lazy_entry::string_t:
@ -427,7 +428,6 @@ namespace {
break; break;
} }
case lazy_entry::none_t: case lazy_entry::none_t:
destruct();
break; break;
} }
return *this; return *this;