Skip to content

Commit 0d491c1

Browse files
WebView part of fix for bug 5307956
JniUtil now returns empty string instead of crashing when the OS can't find/create a cache directory. Have only seen this happen when the whole file system was broken. Change-Id: I867017d62dce83cae3e83959eac9e974433bbdc9
1 parent af33348 commit 0d491c1

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

core/java/android/webkit/JniUtil.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import android.provider.Settings;
2323
import android.util.Log;
2424

25+
import java.io.File;
2526
import java.io.InputStream;
2627

2728
class JniUtil {
@@ -79,7 +80,12 @@ private static synchronized String getCacheDirectory() {
7980
checkInitialized();
8081

8182
if (sCacheDirectory == null) {
82-
sCacheDirectory = sContext.getCacheDir().getAbsolutePath();
83+
File cacheDir = sContext.getCacheDir();
84+
if (cacheDir == null) {
85+
sCacheDirectory = "";
86+
} else {
87+
sCacheDirectory = cacheDir.getAbsolutePath();
88+
}
8389
}
8490

8591
return sCacheDirectory;

0 commit comments

Comments
 (0)