Skip to content

Commit

Permalink
Don't do operations on a closed ZipFile (#68)
Browse files Browse the repository at this point in the history
When zip file was opened inside the loop and it did not contain the lib
inside of it, the `zipFile` stayed non-`null` for all next iterations. This
can cause next iterations that fail to open zip file to access
previously already closed `zipFile` because `zipFile == null` will never
be true.

Fixed by moving the `zipFile` declaration inside of the loop.
  • Loading branch information
blaztinn authored Feb 20, 2020
1 parent 14b082b commit faaee83
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ private ZipFileInZipEntry findAPKWithLibrary(final Context context,
final String mappedLibraryName,
final ReLinkerInstance instance) {

ZipFile zipFile = null;
for (String sourceDir : sourceDirectories(context)) {
ZipFile zipFile = null;
int tries = 0;
while (tries++ < MAX_TRIES) {
try {
Expand Down

0 comments on commit faaee83

Please sign in to comment.