ensure complex resource entry

This commit is contained in:
REAndroid 2023-03-03 06:03:11 -05:00
parent 004f7fc6f1
commit 21c9d4e6bb
3 changed files with 11 additions and 1 deletions

View File

@ -29,6 +29,13 @@ public class EntryArray extends OffsetBlockArray<Entry> implements JSONConvert<J
public EntryArray(IntegerArray offsets, IntegerItem itemCount, IntegerItem itemStart){
super(offsets, itemCount, itemStart);
}
public boolean hasComplexEntry(){
Entry first = iterator(true).next();
if(first==null){
return false;
}
return first.isComplex();
}
public boolean isEmpty(){
return !iterator(true).hasNext();
}

View File

@ -177,7 +177,7 @@ public class TypeBlock extends Chunk<TypeHeader>
.getSpecStringPool().getOrCreate(name);
Entry entry = getOrCreateEntry((short) id);
if(entry.isNull()){
entry.setValueAsRaw(ValueType.NULL, 0);
entry.ensureComplex(getEntryArray().hasComplexEntry());
}
entry.setSpecReference(specString.getIndex());
return entry;

View File

@ -37,6 +37,9 @@
super();
}
public void ensureComplex(boolean isComplex){
ensureTableEntry(isComplex);
}
public int getId(){
return getIndex();
}