From 87e27cca8eba63da0f07c2b588106912e63effcd Mon Sep 17 00:00:00 2001 From: Reginer <282921012@qq.com> Date: Wed, 16 Nov 2022 13:53:31 +0800 Subject: [PATCH 1/2] fix #1502 --- .../src/main/java/com/blankj/utilcode/util/ResourceUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/utilcode/src/main/java/com/blankj/utilcode/util/ResourceUtils.java b/lib/utilcode/src/main/java/com/blankj/utilcode/util/ResourceUtils.java index ca6538a5e9..f99a200783 100644 --- a/lib/utilcode/src/main/java/com/blankj/utilcode/util/ResourceUtils.java +++ b/lib/utilcode/src/main/java/com/blankj/utilcode/util/ResourceUtils.java @@ -198,7 +198,7 @@ public static String readAssets2String(final String assetsFilePath, final String return ""; } } - } catch (IOException e) { + } catch (Exception e) { e.printStackTrace(); return ""; } From 075fac4c0dc8133b06260a15dcc22556562791fe Mon Sep 17 00:00:00 2001 From: Reginer <282921012@qq.com> Date: Wed, 16 Nov 2022 14:08:34 +0800 Subject: [PATCH 2/2] fix #1618 --- .../main/java/com/blankj/utilcode/util/SDCardUtils.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/utilcode/src/main/java/com/blankj/utilcode/util/SDCardUtils.java b/lib/utilcode/src/main/java/com/blankj/utilcode/util/SDCardUtils.java index 10952e779d..179eb4af53 100644 --- a/lib/utilcode/src/main/java/com/blankj/utilcode/util/SDCardUtils.java +++ b/lib/utilcode/src/main/java/com/blankj/utilcode/util/SDCardUtils.java @@ -32,7 +32,12 @@ private SDCardUtils() { * @return {@code true}: enabled
{@code false}: disabled */ public static boolean isSDCardEnableByEnvironment() { - return Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState()); + try { + return Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState()); + }catch (Exception e){ + e.printStackTrace(); + return false; + } } /**