From 0e2b1ebaa115d5af2463e375b5de0f1bcaf08fb8 Mon Sep 17 00:00:00 2001 From: Christian Gogolin Date: Tue, 3 Apr 2018 10:14:57 +0200 Subject: [PATCH] show set library dialoge if Uri.decode(libraryUri.getEncodedPath()) returns null instead of crashing the app --- src/com/cgogolin/library/Library.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/com/cgogolin/library/Library.java b/src/com/cgogolin/library/Library.java index e3398e6..e253bcb 100644 --- a/src/com/cgogolin/library/Library.java +++ b/src/com/cgogolin/library/Library.java @@ -784,11 +784,12 @@ protected void onPreExecute() protected Void doInBackground(String... libraryPathString) { if (bibtexAdapter == null) { - Uri libraryUri = Uri.parse(libraryPathString[0]); - File libraryFile = new File(Uri.decode(libraryUri.getEncodedPath())); InputStream inputStream = null; try { + Uri libraryUri = Uri.parse(libraryPathString[0]); + File libraryFile = new File(Uri.decode(libraryUri.getEncodedPath())); + if(libraryFile != null && libraryFile.isFile()) { inputStream = new FileInputStream(libraryFile);