src/arsc_parser: avoid some NULL dereferences (TODO: should these ever happen or are we doing something wrong?)

This commit is contained in:
Mis012
2022-11-24 23:11:59 +01:00
parent 52ba443401
commit 638667efbb
2 changed files with 8 additions and 1 deletions

View File

@@ -81,6 +81,9 @@ public class ArscResourcesParser {
System.out.println("¯¯ in getResourceId");
ResTableValueEntry res = (ResTableValueEntry)arscFile.getResourceByName(name, typeId);
return res.entryId;
if(res != null)
return res.entryId;
else
return 0;
}
}

View File

@@ -132,6 +132,10 @@ public class ResTablePackageChunk {
System.out.println("¯¯ in ResTablePackageChunk - getResourceByName");
List<BaseTypeChunk> typeList = typeInfoIndexer.get(typeId); // The first chunk in typeList should be ResTableTypeSpecChunk
if(typeList == null) {
System.out.println("¯¯ typeList is null, this is sus...");
return null;
}
for (int i = 1; i < typeList.size(); ++i) {
if (typeList.get(i) instanceof ResTableTypeInfoChunk) {
ResTableTypeInfoChunk x = (ResTableTypeInfoChunk) typeList.get(i);