Skip to content

Commit

Permalink
rtlil.cc: Fix decode for empty string
Browse files Browse the repository at this point in the history
  • Loading branch information
KrystalDelusion committed Jun 10, 2024
1 parent 94b44a3 commit 260cc42
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion kernel/rtlil.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 260cc42

Please sign in to comment.