TeamAmaze / TeamAmaze/AmazeFileManager

`java.lang.IllegalStateException: Fragment `MainFragment` not attached to an context.` on `MainFragment#addToSmb`

Open
#3,712 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

From-telegram Issue-Bug
Dominant language
Kotlin
Stars
6.4k
Forks
1.7k
Avg merge
3d 9h
Merged PRs (30d)
1

Description

Issue explanation (write below this line)

Exception

  • App Name: Amaze File Manager
  • Package: com.amaze.filemanager
  • Version: 3.8.5
  • User Action: UI Error
  • Request: Application crash
  • OS: Linux realme/RMX2030/RMX2030:10/QKQ1.200209.002/1605146661:user/release-keys 10 - 29
  • Device: RMX2030
  • Model: RMX2030
  • Product: RMX2030
Crash log


java.lang.RuntimeException: An error occurred while executing doInBackground()
 at android.os.AsyncTask$4.done(AsyncTask.java:399)
 at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383)
 at java.util.concurrent.FutureTask.setException(FutureTask.java:252)
 at java.util.concurrent.FutureTask.run(FutureTask.java:271)
 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)
Caused by: java.lang.IllegalStateException: Fragment MainFragment{c49cf41} (14ed0b58-4018-43b3-ac32-27676d6a72ed) not attached to a context.
 at androidx.fragment.app.Fragment.requireContext(Fragment.java:919)
 at com.amaze.filemanager.ui.fragments.MainFragment.addToSmb(MainFragment.java:1277)
 at com.amaze.filemanager.asynchronous.asynctasks.LoadFilesListTask.listSmb(LoadFilesListTask.java:600)
 at com.amaze.filemanager.asynchronous.asynctasks.LoadFilesListTask.doInBackground(LoadFilesListTask.java:154)
 at com.amaze.filemanager.asynchronous.asynctasks.LoadFilesListTask.doInBackground(LoadFilesListTask.java:85)
 at android.os.AsyncTask$3.call(AsyncTask.java:378)
 at java.util.concurrent.FutureTask.run(FutureTask.java:266)
 ... 3 more


Reporter: PulauAtlantisTeam

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with MainFragment#addToSmb at MainFragment.java:1277 and trace the call from LoadFilesListTask.listSmb at LoadFilesListTask.java:600. Investigate the fragment lifecycle around the asynchronous task; done means the reported crash no longer occurs when MainFragment is detached during SMB loading.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java, kotlin
Domain
mobile-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.