Only throw an exception in the FSTService when a content for a given wasn't found if the Map is emtpy

This commit is contained in:
Maschell 2019-04-24 13:26:25 +02:00
parent 03181f6078
commit 06184da8d3

View File

@ -104,12 +104,12 @@ public final class FSTService {
if (contentsByIndex != null) { if (contentsByIndex != null) {
Content content = contentsByIndex.get((int) contentIndex); Content content = contentsByIndex.get((int) contentIndex);
if (content == null) { if (content == null) {
if (!entryParam.isDir() || entryParam.isNotInPackage()) { if ((!entryParam.isDir() || entryParam.isNotInPackage()) && !contentsByIndex.isEmpty()) {
// This is only a problem when the data is NOT on aWUDDataPartition (they have no content files)
log.warning("Content for FST Entry not found"); log.warning("Content for FST Entry not found");
throw new ParseException("Content for FST Entry not found", 0); throw new ParseException("Content for FST Entry not found", 0);
} }
} else { } else {
// TODO: make content attribute in a fstentry optional
entryParam.setContent(Optional.of(content)); entryParam.setContent(Optional.of(content));
ContentFSTInfo contentFSTInfo = contentsFSTByIndex.get((int) contentIndex); ContentFSTInfo contentFSTInfo = contentsFSTByIndex.get((int) contentIndex);
if (contentFSTInfo == null) { if (contentFSTInfo == null) {