LuckSiege / PictureSelector

Picture Selector Library for Android or 图片选择器
Apache License 2.0
13.25k stars 3k forks source link

boolean com.luck.picture.lib.entity.LocalMedia.isCompressed()' on a null object reference #1174

Closed kaihavice closed 4 years ago

kaihavice commented 4 years ago

UncaughtException detected: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean com.luck.picture.lib.entity.LocalMedia.isCompressed()' on a null object reference at com.luck.picture.lib.compress.Luban.lambda$launch$0$Luban(Luban.java:155) at com.luck.picture.lib.compress.-$$Lambda$Luban$FIp_nrNo5IFcYhOflpIqR9L2njQ.run(Unknown Source:6) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:289) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) at java.lang.Thread.run(Thread.java:919)

新版疯狂崩溃,看了以下这行代码

if (path.getMedia().isCompressed() && !TextUtils.isEmpty(path.getMedia().getCompressPath())) { // 已经压缩过的图片不重复压缩了 boolean exists = new File(path.getMedia().getCompressPath()).exists(); result = exists ? new File(path.getMedia().getCompressPath()) : compress(context, path); } else {

路径path 没有判空。。

LuckSiege commented 4 years ago

下载demo看下会吗

kaihavice commented 4 years ago

下载demo看下会吗

找到是我这边的原因,资源路径的原因