only:require name

This commit is contained in:
Andrey 2023-12-10 15:01:59 -05:00 committed by rusefillc
parent 30272b6fb7
commit fcac4fed79
2 changed files with 4 additions and 2 deletions

View File

@ -52,7 +52,7 @@ public class ArrayIniField extends IniField {
for (int rowIndex = 0; rowIndex < rows; rowIndex++) {
sb.append("\n ");
for (int colIndex = 0; colIndex < cols; colIndex++) {
Field f = new Field("", getOffset(rowIndex, colIndex), getType());
Field f = new Field(getName() + "_" + colIndex, getOffset(rowIndex, colIndex), getType());
sb.append(' ');
sb.append(f.getAnyValue(image, multiplier));
}

View File

@ -49,7 +49,9 @@ public class Field {
}
public Field(String name, int offset, int stringSize, FieldType type, int bitOffset, String... options) {
this.name = name;
this.name = Objects.requireNonNull(name);
if (name.trim().isEmpty())
throw new IllegalStateException("Empty field name");
this.offset = offset;
this.stringSize = stringSize;
this.type = type;