From 93330d24a6935c7c17958b56f26d646e19f5c50d Mon Sep 17 00:00:00 2001 From: Maschell Date: Wed, 24 Apr 2019 13:33:38 +0200 Subject: [PATCH] The parent of a FSTEntry is now an optional, let's check if it exists before using it. --- pom.xml | 2 +- .../WUDMountedFuseContainer.java | 36 ++++++++++--------- 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/pom.xml b/pom.xml index 75c5716..7654632 100644 --- a/pom.xml +++ b/pom.xml @@ -92,7 +92,7 @@ com.github.Maschell JNUSLib - 75e28a7 + c47c991 org.projectlombok diff --git a/src/main/java/de/mas/wiiu/jnus/fuse_wiiu/implementation/WUDMountedFuseContainer.java b/src/main/java/de/mas/wiiu/jnus/fuse_wiiu/implementation/WUDMountedFuseContainer.java index e535d78..c1277c9 100644 --- a/src/main/java/de/mas/wiiu/jnus/fuse_wiiu/implementation/WUDMountedFuseContainer.java +++ b/src/main/java/de/mas/wiiu/jnus/fuse_wiiu/implementation/WUDMountedFuseContainer.java @@ -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 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)); } }