Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.

Commit fff86b3

Browse files
Fix NPE when invoking copyNecessaryFilesFromCurrentPackage() method on Android (#2566)
* Fix NPE when invoking `copyNecessaryFilesFromCurrentPackage()` method on Android. * Add logging and check if the path exists * fixup --------- Co-authored-by: Anatoly Pristensky <v-anatpr@microsoft.com>
1 parent ae7ff33 commit fff86b3

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

android/app/src/main/java/com/microsoft/codepush/react/CodePushUpdateUtils.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,10 @@ private static String computeHash(InputStream dataStream) {
9898
}
9999

100100
public static void copyNecessaryFilesFromCurrentPackage(String diffManifestFilePath, String currentPackageFolderPath, String newPackageFolderPath) throws IOException {
101-
FileUtils.copyDirectoryContents(currentPackageFolderPath, newPackageFolderPath);
101+
if (currentPackageFolderPath == null || !new File(currentPackageFolderPath).exists()) {
102+
CodePushUtils.log("Unable to copy files from current package during diff update, because currentPackageFolderPath is invalid.");
103+
return;
104+
}
102105
JSONObject diffManifest = CodePushUtils.getJsonObjectFromFile(diffManifestFilePath);
103106
try {
104107
JSONArray deletedFiles = diffManifest.getJSONArray("deletedFiles");

0 commit comments

Comments
 (0)