Antennapod: "Visit website" button crashes app if there is no browser installed

Created on 6 Oct 2020  路  17Comments  路  Source: AntennaPod/AntennaPod

Checklist

  • [x] I have used the search function to see if someone else has already submitted the same bug report.
  • [x] I will describe the problem with as much detail as possible.
  • [x] If the bug only to occurs with a certain podcast, I will include the URL of that podcast.

System info

App version: 2.0.1

App source: Google Play

Bug description

Steps to reproduce:

  1. Get a system without any web browser installed (this is kind of hard. Maybe disabling could work)
  2. Press the "Visit website" action button (displayed for text-only feeds)

Expected behaviour:

Display error message or do nothing

Current behaviour:

Crash

Proposal for fix:

Catch the exception in VisitWebsiteActionButton

Stacktrace/Logcat:

android.content.ActivityNotFoundException: 
  at android.app.Instrumentation.checkStartActivityResult (Instrumentation.java:2064)
  at android.app.Instrumentation.execStartActivity (Instrumentation.java:1718)
  at android.app.Activity.startActivityForResult (Activity.java:5192)
  at androidx.fragment.app.FragmentActivity.startActivityForResult (FragmentActivity.java:675)
  at android.app.Activity.startActivityForResult (Activity.java:5150)
  at androidx.fragment.app.FragmentActivity.startActivityForResult (FragmentActivity.java:662)
  at android.app.Activity.startActivity (Activity.java:5521)
  at android.app.Activity.startActivity (Activity.java:5489)
  at de.danoeh.antennapod.adapter.actionbutton.VisitWebsiteActionButton.onClick (VisitWebsiteActionButton.java:33)
  at de.danoeh.antennapod.fragment.ItemFragment.lambda$onCreateView$4 (ItemFragment.java:188)
  at de.danoeh.antennapod.fragment.-$$Lambda$ItemFragment$6EQCf35FoYVPvPZWekKZ-4ZsJcs.onClick (Unknown Source:2)
  at android.view.View.performClick (View.java:7155)
  at android.view.View.performClickInternal (View.java:7124)
  at android.view.View.access$3500 (View.java:808)
  at android.view.View$PerformClick.run (View.java:27370)
  at android.os.Handler.handleCallback (Handler.java:883)
  at android.os.Handler.dispatchMessage (Handler.java:100)
  at android.os.Looper.loop (Looper.java:359)
  at android.app.ActivityThread.main (ActivityThread.java:7418)
  at java.lang.reflect.Method.invoke (Method.java)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:492)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:935)
confirmed bug good first issue hacktoberfest

Most helpful comment

Hi @studentPavel and @ankitbeniwal! Great to hear that you both want to help make AntennaPod better :-)

I guess we'll assign this to the first person that indicated their interest. We can only merge one PR, after all. @ankitbeniwal I suggest to have a look at issues that hasn't been assigned yet and that no one else has already indicated interest in. In theory, you can take any issue but it's suggested to pick something labelled with hacktoberfest or good first issue. They normally have a pretty "local" scope and do not need big discussions about how to actually do it.

All 17 comments

Hi ByteHamster, could I take a look at it? Could you assigne it to me?

I am interested to work on this.

Hi @studentPavel and @ankitbeniwal! Great to hear that you both want to help make AntennaPod better :-)

I guess we'll assign this to the first person that indicated their interest. We can only merge one PR, after all. @ankitbeniwal I suggest to have a look at issues that hasn't been assigned yet and that no one else has already indicated interest in. In theory, you can take any issue but it's suggested to pick something labelled with hacktoberfest or good first issue. They normally have a pretty "local" scope and do not need big discussions about how to actually do it.

Thanks @keunes I will report you all my findings and hope I will fix it as soon as possbile.

(Just to clarify: PR review will be done by the app developer. I'm just helping out with moderation but I can't by any means code, let alone review.)

Hello, I have the project already set up, may I work on this issue?

Hey @ByteHamster , I could not find any read only podcast, do you have any examples?

Hi @ezesalas7
Thanks for your interest in helping AntennaPod! As you can see in the above comments, there were some other folks interested in working on this as well, and it's been assigned already.

As we can only accept one PR per issue, I suggest to have a look at issues that hasn't been assigned yet and that no one else has already indicated interest in. In theory, you can take any issue but it's suggested to pick something labelled with hacktoberfest or good first issue. They normally have a pretty "local" scope and do not need big discussions about how to actually do it.

Okay, I will take a look arround other issues, thanks.

Hi @ezesalas7
Thanks for your interest in helping AntennaPod! As you can see in the above comments, there were some other folks interested in working on this as well, and it's been assigned already.

As we can only accept one PR per issue, I suggest to have a look at issues that hasn't been assigned yet and that no one else has already indicated interest in. In theory, you can take any issue but it's suggested to pick something labelled with hacktoberfest or good first issue. They normally have a pretty "local" scope and do not need big discussions about _how_ to actually do it.

Hey @studentPavel and @ankitbeniwal , did you manage to take a look at this issue ? Otherwise I am interested in fixing it. Let me know :)

Ok @Xeitor take it, i have take a look at it but it is quite problem to reproduce bug...chrome is in anroid core and i dont know how to give it away...maybe emulator will help... @keunes you can assign it to some more clever like me :-)

It seems like It has already beeing fixed, check IntentUtils class:

    public static void openInBrowser(Context context, String url) {
        try {
            Intent myIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
            myIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            context.startActivity(myIntent);
        } catch (ActivityNotFoundException e) {
            Toast.makeText(context, R.string.pref_no_browser_found, Toast.LENGTH_LONG).show();
            Log.e(TAG, Log.getStackTraceString(e));
        }
    }

VisitWebsiteActionButton does not use openInBrowser. It creates its own intent and crashes. I guess making VisitWebsiteActionButton use openInBrowser would be most clean.

I think this can now be assigned to me. I am ready to take it up since @studentPavel unassigned himself. @Xeitor I have looked at the bug and I am ready to work on it.

I was about to submmit the pull request, since I had already discussed the solution with @ByteHamster

oh alright. If you have already fixed it then go ahead and make a PR. No problem @Xeitor

Closed in #4520

Was this page helpful?
0 / 5 - 0 ratings