nextcloud / android

📱 Nextcloud Android app
https://play.google.com/store/apps/details?id=com.nextcloud.client
GNU General Public License v2.0
4.06k stars 1.74k forks source link

No preview available: swiping back to an image, and then attempting to download full res crash: `IllegalStateException: Fragment PreviewImageFragment` #7808

Open jtagcat opened 3 years ago

jtagcat commented 3 years ago

Steps to reproduce

  1. Open an image without previee
  2. You get a banner of 'No resized image available. Download full image?`
  3. Swipe left/right to a different image
  4. Swipe back to an image
  5. Press 'Yes on the prompt'
  6. Crash

Actual behaviour

************ CAUSE OF ERROR ************

java.lang.IllegalStateException: Fragment PreviewImageFragment{664772} (9721b654-8491-43f8-a319-f75dd1f46fa2)} not attached to a context.
    at androidx.fragment.app.Fragment.requireContext(Fragment.java:805)
    at androidx.fragment.app.Fragment.getResources(Fragment.java:869)
    at com.owncloud.android.ui.preview.PreviewImageFragment.lambda$setErrorPreviewMessage$2$PreviewImageFragment(PreviewImageFragment.java:744)
    at com.owncloud.android.ui.preview.-$$Lambda$PreviewImageFragment$lYlNRKiEmwgldJH0g5sQ-_uYXY4.onClick(Unknown Source:2)
    at com.google.android.material.snackbar.Snackbar$1.onClick(Snackbar.java:307)
    at android.view.View.performClick(View.java:7259)
    at com.google.android.material.button.MaterialButton.performClick(MaterialButton.java:992)
    at android.view.View.performClickInternal(View.java:7236)
    at android.view.View.access$3600(View.java:801)
    at android.view.View$PerformClick.run(View.java:27892)
    at android.os.Handler.handleCallback(Handler.java:883)
    at android.os.Handler.dispatchMessage(Handler.java:100)
    at android.os.Looper.loop(Looper.java:214)
    at android.app.ActivityThread.main(ActivityThread.java:7356)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:491)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:940)

************ APP INFORMATION ************
ID: com.nextcloud.client
Version: 30140190
Build flavor: generic

************ DEVICE INFORMATION ************
Brand: OnePlus
Device: OnePlus5T
Model: ONEPLUS A5010
Id: QQ3A.200805.001
Product: OnePlus5T

************ FIRMWARE ************
SDK: 29
Release: 10
Incremental: 9cce4d08bf

Can you reproduce this problem on https://try.nextcloud.com?

Yes

Environment data

Dumpling Lineage latest (no google apps and services and stuff, though it's the fdroid version).

NOTE: Be super sure to remove sensitive data like passwords, note that everybody can look here! You can use the Issue Template application to prefill some of the required information: https://apps.nextcloud.com/apps/issuetemplate

tobiasKaminsky commented 3 years ago

Related to #8054