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

Commit 9abe1a5

Browse files
Fix npe for copyNecessaryFilesFromCurrentPackage
1 parent 94bcd15 commit 9abe1a5

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,11 @@ 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+
}
105+
FileUtils.copyDirectoryContents(currentPackageFolderPath, newPackageFolderPath);
102106
JSONObject diffManifest = CodePushUtils.getJsonObjectFromFile(diffManifestFilePath);
103107
try {
104108
JSONArray deletedFiles = diffManifest.getJSONArray("deletedFiles");

0 commit comments

Comments
 (0)