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> <dependency>
<groupId>com.github.Maschell</groupId> <groupId>com.github.Maschell</groupId>
<artifactId>JNUSLib</artifactId> <artifactId>JNUSLib</artifactId>
<version>75e28a7</version> <version>c47c991</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.projectlombok</groupId> <groupId>org.projectlombok</groupId>

View File

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