Fix possible NPE

Fixes #347
This commit is contained in:
Nico Mexis 2021-08-27 00:00:04 +02:00
parent 20920eab5a
commit a383c52619
No known key found for this signature in database
GPG key ID: 27D6E17CE092AB78
2 changed files with 2 additions and 2 deletions

View file

@ -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";

View file

@ -201,7 +201,7 @@ public class JarUtils
*/
public static Map<String, byte[]> 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<String, byte[]> files = new LinkedHashMap<>();