The parent of a FSTEntry is now an optional, let's check if it exists before using it.

This commit is contained in:
Maschell 2019-04-24 13:33:38 +02:00
parent 3005ed981f
commit 93330d24a6
2 changed files with 21 additions and 17 deletions

View File

@ -92,7 +92,7 @@
<dependency>
<groupId>com.github.Maschell</groupId>
<artifactId>JNUSLib</artifactId>
<version>75e28a7</version>
<version>c47c991</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>

View File

@ -40,27 +40,31 @@ public class WUDMountedFuseContainer extends WUDFuseContainer {
try {
for (FSTDataProvider dp : dps) {
for (FSTEntry tmd : FSTUtils.getFSTEntriesByRegEx(dp.getRoot(), ".*tmd")) {
FSTEntry parent = tmd.getParent();
if (parent.getFileChildren().stream().filter(f -> f.getFilename().endsWith(".app")).findAny().isPresent()) {
FSTDataProvider fdp = null;
Optional<FSTEntry> parentOpt = tmd.getParent();
if (parentOpt.isPresent()) {
FSTEntry parent = parentOpt.get();
if (parent.getFileChildren().stream().filter(f -> f.getFilename().endsWith(".app")).findAny().isPresent()) {
FSTDataProvider fdp = null;
try {
fdp = new FSTDataProviderNUSTitle(NUSTitleLoaderFST.loadNUSTitle(dp, parent, Settings.retailCommonKey));
} catch (IOException | ParseException e) {
try {
fdp = new FSTDataProviderNUSTitle(NUSTitleLoaderFST.loadNUSTitle(dp, parent, Settings.devCommonKey));
} catch (Exception e1) {
System.out.println("Ignoring " + parent.getFilename() + " :" + e1.getClass().getName() + " " + e1.getMessage());
fdp = new FSTDataProviderNUSTitle(NUSTitleLoaderFST.loadNUSTitle(dp, parent, Settings.retailCommonKey));
} catch (IOException | ParseException e) {
try {
fdp = new FSTDataProviderNUSTitle(NUSTitleLoaderFST.loadNUSTitle(dp, parent, Settings.devCommonKey));
} catch (Exception e1) {
System.out.println("Ignoring " + parent.getFilename() + " :" + e1.getClass().getName() + " " + e1.getMessage());
continue;
}
} catch (Exception e) {
System.out.println("Ignoring " + parent.getFilename() + " :" + e.getClass().getName() + " " + e.getMessage());
continue;
}
} catch (Exception e) {
System.out.println("Ignoring " + parent.getFilename() + " :" + e.getClass().getName() + " " + e.getMessage());
continue;
FSTDataProvider fdpCpy = fdp;
this.addFuseContainer("[DECRYPTED] [" + dp.getName() + "] " + parent.getFilename(),
new FSTDataProviderContainer(getParent(), fdpCpy));
}
FSTDataProvider fdpCpy = fdp;
this.addFuseContainer("[DECRYPTED] [" + dp.getName() + "] " + parent.getFilename(), new FSTDataProviderContainer(getParent(), fdpCpy));
}
}