Slide: ShadowBox Incorrect handling of Fragment type VREDDIT_REDIRECT

Created on 17 Mar 2018  路  7Comments  路  Source: ccrama/Slide

Slide version: 5.8.2
Android version: 8.1

03-17 06:20:58.901 17346 17346 D AndroidRuntime: Shutting down VM
03-17 06:20:58.901 17346 17346 E AndroidRuntime: FATAL EXCEPTION: main
03-17 06:20:58.901 17346 17346 E AndroidRuntime: Process: me.ccrama.redditslide, PID: 17346
03-17 06:20:58.901 17346 17346 E AndroidRuntime: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v4.app.Fragment.setMenuVisibility(boolean)' on a null object reference
03-17 06:20:58.901 17346 17346 E AndroidRuntime:    at android.support.v4.app.FragmentStatePagerAdapter.instantiateItem(FragmentStatePagerAdapter.java:120)
03-17 06:20:58.901 17346 17346 E AndroidRuntime:    at android.support.v4.view.ViewPager.addNewItem(ViewPager.java:1004)
03-17 06:20:58.901 17346 17346 E AndroidRuntime:    at android.support.v4.view.ViewPager.populate(ViewPager.java:1218)
03-17 06:20:58.901 17346 17346 E AndroidRuntime:    at android.support.v4.view.ViewPager.populate(ViewPager.java:1086)
03-17 06:20:58.901 17346 17346 E AndroidRuntime:    at android.support.v4.view.ViewPager$3.run(ViewPager.java:267)
03-17 06:20:58.901 17346 17346 E AndroidRuntime:    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:911)
03-17 06:20:58.901 17346 17346 E AndroidRuntime:    at android.view.Choreographer.doCallbacks(Choreographer.java:723)
03-17 06:20:58.901 17346 17346 E AndroidRuntime:    at android.view.Choreographer.doFrame(Choreographer.java:655)
03-17 06:20:58.901 17346 17346 E AndroidRuntime:    at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:897)
03-17 06:20:58.901 17346 17346 E AndroidRuntime:    at android.os.Handler.handleCallback(Handler.java:790)
03-17 06:20:58.901 17346 17346 E AndroidRuntime:    at android.os.Handler.dispatchMessage(Handler.java:99)
03-17 06:20:58.901 17346 17346 E AndroidRuntime:    at android.os.Looper.loop(Looper.java:164)
03-17 06:20:58.901 17346 17346 E AndroidRuntime:    at android.app.ActivityThread.main(ActivityThread.java:6494)
03-17 06:20:58.901 17346 17346 E AndroidRuntime:    at java.lang.reflect.Method.invoke(Native Method)
03-17 06:20:58.901 17346 17346 E AndroidRuntime:    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
03-17 06:20:58.901 17346 17346 E AndroidRuntime:    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
03-17 06:20:58.917  3603 17173 W ActivityManager:   Force finishing activity me.ccrama.redditslide/.Activities.Shadowbox
03-17 06:20:58.924  3603 17173 W ActivityManager:   Force finishing activity me.ccrama.redditslide/.Activities.MainActivity
03-17 06:20:58.961  3603  3618 I ActivityManager: Showing crash dialog for package me.ccrama.redditslide u0

Most helpful comment

You're so cool :) Thank you so much!

All 7 comments

Adding debug line in "Shadowbox.java" (i use shadowbox as personal favorite), right before OverviewPagerAdapter.getItem(int i) return statement ("return f;")

LogUtil.e("ShadowBox Returned fragment null? " + (f==null?"null":"no") + ", contentType: " + t.name());

Shows

E/(Shadowbox.java:255): ShadowBox Returned fragment null? null, contentType: VREDDIT_REDIRECT

And the stack-trace above is caused by NULL item returned from FragmentStatePagerAdapter.getItem(int position)

@ccrama I tried to fix the issue, however I don't see the correct usage for these enum types, could you advise please?

I must have missed this issue initially, thanks for the detailed report! Trying to figure out why it's even getting VREDDIT_REDIRECT as a content type as that should not be possible to reach in shadowbox. Give me a few hours

Actually this is a little more complicated than I had hoped, if it's a crosspost there is no way for me to get this data so we will have to just handle it as a direct link url if that is the case

You're so cool :) Thank you so much!

Was this page helpful?
0 / 5 - 0 ratings