diff --git a/frontends/verilog/const2ast.cc b/frontends/verilog/const2ast.cc index 9cc99750f..4a58357bf 100644 --- a/frontends/verilog/const2ast.cc +++ b/frontends/verilog/const2ast.cc @@ -122,7 +122,7 @@ static void my_strtobin(std::vector &data, const char *str, int le } int len = GetSize(data); - RTLIL::State msb = data.back(); + RTLIL::State msb = data.empty() ? RTLIL::S0 : data.back(); if (len_in_bits < 0) { if (len < 32)