Value::assign() handle !valid()

This commit is contained in:
Michael Davidsaver
2020-03-12 10:14:48 -07:00
parent 3d3d0dcfa6
commit ed0f6c3fc6
+5 -2
View File
@@ -151,7 +151,10 @@ Value Value::clone() const
Value& Value::assign(const Value& o)
{
if(desc!=o.desc &&
if(!desc || !o.desc) {
// handled below
} else if(desc!=o.desc &&
desc->code==o.desc->code &&
(desc->code.kind()==Kind::Integer
|| desc->code.kind()==Kind::Real
@@ -165,7 +168,7 @@ Value& Value::assign(const Value& o)
throw std::runtime_error("Can only assign same TypeDef");
}
if(desc) {
if(desc && o.desc) {
for(size_t bit=0, end=desc->size(); bit<end;) {
auto sstore = o.store.get() + bit;
auto dstore = store.get() + bit;