fix ResourceExtractor npe. (flutter/engine#6461)

This commit is contained in:
谢然
2018-10-13 00:56:00 +08:00
committed by Jason Simmons
parent a1729ab278
commit 3f6afa9c58

View File

@@ -101,6 +101,11 @@ class ResourceExtractor {
TIMESTAMP_PREFIX + packageInfo.versionCode + "-" + packageInfo.lastUpdateTime;
final String[] existingTimestamps = getExistingTimestamps(dataDir);
if (existingTimestamps == null) {
return null;
}
if (existingTimestamps.length != 1
|| !expectedTimestamp.equals(existingTimestamps[0])) {
return expectedTimestamp;
@@ -173,7 +178,11 @@ class ResourceExtractor {
file.delete();
}
}
for (String timestamp : getExistingTimestamps(dataDir)) {
final String[] existingTimestamps = getExistingTimestamps(dataDir);
if (existingTimestamps == null) {
return;
}
for (String timestamp : existingTimestamps) {
new File(dataDir, timestamp).delete();
}
}