From a383c52619e2919582bec91f3c3dfbb0b635dbad Mon Sep 17 00:00:00 2001 From: Nico Mexis Date: Fri, 27 Aug 2021 00:00:04 +0200 Subject: [PATCH] Fix possible NPE Fixes #347 --- .../resources/importing/impl/APKResourceImporter.java | 2 +- .../java/the/bytecode/club/bytecodeviewer/util/JarUtils.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/resources/importing/impl/APKResourceImporter.java b/src/main/java/the/bytecode/club/bytecodeviewer/resources/importing/impl/APKResourceImporter.java index fb7c6faf..415191fc 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/resources/importing/impl/APKResourceImporter.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/resources/importing/impl/APKResourceImporter.java @@ -56,7 +56,7 @@ public class APKResourceImporter implements Importer container.resourceFiles = JarUtils.loadResources(decodedResources); } - Objects.requireNonNull(container.resourceFiles).putAll(JarUtils.loadResources(tempCopy)); //copy and rename + container.resourceFiles.putAll(JarUtils.loadResources(tempCopy)); // copy and rename // to prevent unicode filenames String name = MiscUtils.getRandomizedName() + ".jar"; diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/util/JarUtils.java b/src/main/java/the/bytecode/club/bytecodeviewer/util/JarUtils.java index bd7a37fb..62565995 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/util/JarUtils.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/util/JarUtils.java @@ -201,7 +201,7 @@ public class JarUtils */ public static Map loadResources(final File zipFile) throws IOException { if (!zipFile.exists()) - return null; //just ignore + return new LinkedHashMap<>(); // just ignore (don't return null for null-safety!) Map files = new LinkedHashMap<>();