Skip to content

Commit 4247313

Browse files
committedMay 19, 2020
[tinker] bugfix: NPE was thrown if new apk has more dexes than old one.
·
v1.9.15.2v1.9.14.8
1 parent e595c1d commit 4247313

File tree

1 file changed

+4
-5
lines changed
  • tinker-build/tinker-patch-lib/src/main/java/com/tencent/tinker/build/decoder

1 file changed

+4
-5
lines changed
 

‎tinker-build/tinker-patch-lib/src/main/java/com/tencent/tinker/build/decoder/DexDiffDecoder.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -188,18 +188,13 @@ public boolean patch(final File oldFile, final File newFile) throws IOException,
188188
e.printStackTrace();
189189
}
190190

191-
// Collect class descriptors here for further checking.
192-
collectClassesInDex(oldFile);
193-
oldDexFiles.add(oldFile);
194-
195191
// If corresponding new dex was completely deleted, just return false.
196192
// don't process 0 length dex
197193
if (newFile == null || !newFile.exists() || newFile.length() == 0) {
198194
return false;
199195
}
200196

201197
File dexDiffOut = getOutputPath(newFile).toFile();
202-
203198
final String newMd5 = getRawOrWrappedDexMD5(newFile);
204199

205200
//new add file
@@ -209,6 +204,10 @@ public boolean patch(final File oldFile, final File newFile) throws IOException,
209204
return true;
210205
}
211206

207+
// Collect class descriptors here for further checking.
208+
collectClassesInDex(oldFile);
209+
oldDexFiles.add(oldFile);
210+
212211
final String oldMd5 = getRawOrWrappedDexMD5(oldFile);
213212

214213
if ((oldMd5 != null && !oldMd5.equals(newMd5)) || (oldMd5 == null && newMd5 != null)) {

0 commit comments

Comments
 (0)
Please sign in to comment.