diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index ff9ac9d57..016fc58c6 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -60,6 +60,7 @@ diff --git a/app/src/main/java/com/seafile/seadroid2/data/DataManager.java b/app/src/main/java/com/seafile/seadroid2/data/DataManager.java index 94909e683..18269258f 100644 --- a/app/src/main/java/com/seafile/seadroid2/data/DataManager.java +++ b/app/src/main/java/com/seafile/seadroid2/data/DataManager.java @@ -488,6 +488,9 @@ public synchronized File getFileByBlocks(String repoName, String repoID, String } final Pair pair = getRepoEncKey(repoID); + if (pair == null) { + throw SeafException.decryptException; + } final String encKey = pair.first; final String encIv = pair.second; if (TextUtils.isEmpty(encKey) || TextUtils.isEmpty(encIv)) { @@ -646,6 +649,9 @@ public List getCachedFiles() { } public void addCachedFile(String repoName, String repoID, String path, String fileID, File file) { + if (file == null) { + return; + } // notify Android Gallery that a new file has appeared // file does not always reside in Seadroid directory structure (e.g. camera upload) diff --git a/app/src/main/java/com/seafile/seadroid2/ui/activity/BrowserActivity.java b/app/src/main/java/com/seafile/seadroid2/ui/activity/BrowserActivity.java index 462b07aaa..18f4e6939 100644 --- a/app/src/main/java/com/seafile/seadroid2/ui/activity/BrowserActivity.java +++ b/app/src/main/java/com/seafile/seadroid2/ui/activity/BrowserActivity.java @@ -1557,6 +1557,10 @@ else if (which == 1) // create folder * @param fileName */ public void downloadFile(String dir, String fileName) { + // txService maybe null if layout orientation has changed + if (txService == null) { + return; + } String filePath = Utils.pathJoin(dir, fileName); txService.addDownloadTask(account, navContext.getRepoName(), @@ -1700,6 +1704,10 @@ protected void onPostExecute(List dirents) { } private void startFileActivity(String repoName, String repoID, String filePath, long fileSize) { + // txService maybe null if layout orientation has changed + if (txService == null) { + return; + } int taskID = txService.addDownloadTask(account, repoName, repoID, filePath, fileSize); Intent intent = new Intent(this, FileActivity.class); intent.putExtra("repoName", repoName);