mirror of https://github.com/YosysHQ/yosys.git
rtlil.cc: Fix decode for empty string
This commit is contained in:
parent
94b44a37b2
commit
260cc42c2f
|
@ -337,7 +337,10 @@ std::string RTLIL::Const::decode_string() const
|
|||
}
|
||||
s.append({ch});
|
||||
}
|
||||
return s.substr(s.find_first_not_of('\0'));
|
||||
auto first_char = s.find_first_not_of('\0');
|
||||
if (first_char != std::string::npos)
|
||||
return s.substr(first_char);
|
||||
else return s;
|
||||
}
|
||||
|
||||
bool RTLIL::Const::is_fully_zero() const
|
||||
|
|
Loading…
Reference in New Issue