StringIndexOutOfBoundsException in PropertySheet

There was a report on ConsimWorld about a problem with loading the
Vietnam (VG) module with 3.0, which I’ve tracked down to neglecting
to check whether a string is empty before taking a substring starting
at position 1.

In 3.0.17, this is at line 831 of VASSAL.counters.PropertySheet, in
PropertySheet.getI18nData(). If I change the line

 items.add(item.substring(1));

to

 items.add(item.isEmpty() ? "" : item.substring(1));

I can load the module without any exceptions, but I’m not familiar
with the code here so I haven’t been able to satisfy myself that
my fix is correct.

Can anyone comment on this?

This error looks like it’s being caused by having 0 rows defined in the Property Sheet. This code change is a safe way to catch that condition.

rk

Post generated using Mail2Forum (mail2forum.com)