LuckSiege / PictureSelector

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

SelectorProviders.getInstance().getSelectorConfig() java.lang.NullPointerException #2645

Closed zhanglq060 closed 1 year ago

zhanglq060 commented 1 year ago

Current use version?

当前使用的版本是多少?

v3.11.0

Will this problem occur in demo?

Demo能否复现这问题?

不容易复现

Describe the problem or provide an error log?

描述问题或提供错误log?

PictureSelectorSupporterActivity 
@Override
    protected void attachBaseContext(Context newBase) {
        super.attachBaseContext(PictureContextWrapper.wrap(newBase,
                SelectorProviders.getInstance().getSelectorConfig().language, SelectorProviders.getInstance().getSelectorConfig().defaultLanguage));
    }

Caused by java.lang.NullPointerException: Attempt to read from field 'int gg.a.m' on a null object reference
       at com.luck.picture.lib.basic.PictureSelectorSupporterActivity.attachBaseContext(PictureSelectorSupporterActivity.java:81)

SelectorProviders.getInstance().getSelectorConfig() 可能为null,最好处理一下
henryhong111 commented 1 year ago

3.11.0 申请权限多次拒绝 容易出现这个问题

henryhong111 commented 1 year ago

3.11.0

我自己一个用户去测试 就收集到3次这种崩溃,感觉还是概率挺高的 希望可以修复下 @LuckSiege

Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.hk.azal.live/com.luck.picture.lib.basic.PictureSelectorSupporterActivity}: java.lang.NullPointerException: Attempt to read from field 'int com.luck.picture.lib.config.SelectorConfig.language' on a null object reference in method 'void com.luck.picture.lib.basic.PictureSelectorSupporterActivity.attachBaseContext(android.content.Context)' at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3676) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3813) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:101) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2308) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loopOnce(Looper.java:201) at android.os.Looper.loop(Looper.java:288) at android.app.ActivityThread.main(ActivityThread.java:7898) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)

Caused by java.lang.NullPointerException: Attempt to read from field 'int com.luck.picture.lib.config.SelectorConfig.language' on a null object reference in method 'void com.luck.picture.lib.basic.PictureSelectorSupporterActivity.attachBaseContext(android.content.Context)' at com.luck.picture.lib.basic.PictureSelectorSupporterActivity.attachBaseContext(PictureSelectorSupporterActivity.java:81) at android.app.Activity.attach(Activity.java:8182) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3626) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3813) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:101) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2308) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loopOnce(Looper.java:201) at android.os.Looper.loop(Looper.java:288) at android.app.ActivityThread.main(ActivityThread.java:7898) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)

LuckSiege commented 1 year ago

3.11.1 版本已修复

henryhong111 commented 1 year ago

3.11.1 版本已修复

非常感谢