jenly1314 / WeChatQRCode

⛄ 基于OpenCV开源的微信二维码引擎移植的二维码扫码识别库
https://jenly1314.github.io/WeChatQRCode/
Apache License 2.0
607 stars 120 forks source link

修复获取外部存储目录时的NPE #42

Closed iamwent closed 6 months ago

iamwent commented 10 months ago

Context.getExternalFilesDirs 这个方法 returns the absolute paths to application-specific directories. Some individual paths may be null if that shared storage is not currently available. The first path returned is the same as getExternalFilesDir(String). 也就是说 files[0].getAbsolutePath() 可能会产生 NPE

jenly1314 commented 6 months ago

context.getExternalFilesDir是一个过时的方法,从API 19之后就不推荐使用了。