Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0d491c1d authored by Kristian Monsen's avatar Kristian Monsen
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
parent af333486
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import android.net.Uri;
import android.provider.Settings;
import android.util.Log;

import java.io.File;
import java.io.InputStream;

class JniUtil {
@@ -79,7 +80,12 @@ class JniUtil {
        checkInitialized();

        if (sCacheDirectory == null) {
            sCacheDirectory = sContext.getCacheDir().getAbsolutePath();
            File cacheDir = sContext.getCacheDir();
            if (cacheDir == null) {
                sCacheDirectory = "";
            } else {
                sCacheDirectory = cacheDir.getAbsolutePath();
            }
        }

        return sCacheDirectory;