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 {
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 没有判空。。