warren-bank / Android-WebCast

Android app to extract video (file/stream) URLs from websites and watch them elsewhere (internal/external video player, Google Chromecast, ExoAirPlayer).
GNU General Public License v2.0
97 stars 17 forks source link

On Android 6, the default homepage is `null` instead of "about:blank". Clicking the `bookmark` toggle icon causes app to crash. #1

Closed sagorahmed closed 5 years ago

sagorahmed commented 5 years ago

Expected behavior

I expected that the app would warn or block me when I tried to bookmark a blank page.

Actual behavior

The app crashed when I bookmarked a blank page. After that this crash occurring every time whenever I am trying to open the app.

How to reproduce

Here is every possible detail to reproduce the bug.

  1. Open the app
  2. Click on the bookmark button at the top of your screen.
  3. Notice the crash. After that, whenever you will try to open this app, you have to face the crash. (You can make it workable again after deleting the app data)

Recording Of The Bug

bug

LogCat

05-21 14:35:14.108  8984  8984 E AndroidRuntime: FATAL EXCEPTION: main

05-21 14:35:14.108  8984  8984 E AndroidRuntime: Process: com.github.warren_bank.webcast, PID: 8984

05-21 14:35:14.108  8984  8984 E AndroidRuntime: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference

05-21 14:35:14.108  8984  8984 E AndroidRuntime:    at com.github.warren_bank.webcast.webview.BrowserActivity$DrawerListItem.equal(Unknown Source)

05-21 14:35:14.108  8984  8984 E AndroidRuntime:    at com.github.warren_bank.webcast.webview.BrowserActivity$DrawerListItem.find(Unknown Source)

05-21 14:35:14.108  8984  8984 E AndroidRuntime:    at com.github.warren_bank.webcast.webview.BrowserActivity$DrawerListItem.contains(Unknown Source)

05-21 14:35:14.108  8984  8984 E AndroidRuntime:    at com.github.warren_bank.webcast.webview.BrowserActivity.onCreateOptionsMenu(Unknown Source)

05-21 14:35:14.108  8984  8984 E AndroidRuntime:    at android.app.Activity.onCreatePanelMenu(Activity.java:3142)

05-21 14:35:14.108  8984  8984 E AndroidRuntime:    at androidx.f.a.e.onCreatePanelMenu(Unknown Source)

05-21 14:35:14.108  8984  8984 E AndroidRuntime:    at androidx.appcompat.view.i.onCreatePanelMenu(Unknown Source)

05-21 14:35:14.108  8984  8984 E AndroidRuntime:    at androidx.appcompat.app.g$d.onCreatePanelMenu(Unknown Source)

05-21 14:35:14.108  8984  8984 E AndroidRuntime:    at androidx.appcompat.view.i.onCreatePanelMenu(Unknown Source)

05-21 14:35:14.108  8984  8984 E AndroidRuntime:    at androidx.appcompat.app.j.i(Unknown Source)

05-21 14:35:14.108  8984  8984 E AndroidRuntime:    at androidx.appcompat.app.j$1.run(Unknown Source)

05-21 14:35:14.108  8984  8984 E AndroidRuntime:    at android.os.Handler.handleCallback(Handler.java:739)

05-21 14:35:14.108  8984  8984 E AndroidRuntime:    at android.os.Handler.dispatchMessage(Handler.java:95)

05-21 14:35:14.108  8984  8984 E AndroidRuntime:    at android.os.Looper.loop(Looper.java:148)

05-21 14:35:14.108  8984  8984 E AndroidRuntime:    at android.app.ActivityThread.main(ActivityThread.java:7325)

05-21 14:35:14.108  8984  8984 E AndroidRuntime:    at java.lang.reflect.Method.invoke(Native Method)

05-21 14:35:14.108  8984  8984 E AndroidRuntime:    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)

05-21 14:35:14.108  8984  8984 E AndroidRuntime:    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
warren-bank commented 5 years ago

Hi. Thanks so much for your excellent bug report.

I'll definitely have a fix posted by tomorrow. Unfortunately, I can't reproduce it on my phones.. they're all running older versions of Android.. so I'll need to fire up an emulator.

If I was to guess.. it's probably that newer versions of WebView treat "about:blank" differently; it looks like yours is returning null when asked for the current URL.

In any case.. adding a line of validation to catch a non-sensical URL value would be easy.. and prevent this from happening.

sagorahmed commented 5 years ago

Thank you so much for your fast reply on the issues. Good to see how much you take care of your project.

warren-bank commented 5 years ago

I just pushed a very minor update

..I haven't reproduced this crash (yet), but I'm guessing this should prevent it from happening.

sagorahmed commented 5 years ago

Nothing changed. It is behaving weirdly like before.

warren-bank commented 5 years ago

I amended the previous commit.. this new update fixes the error.

Thanks again for letting me know that there was a problem; I really do appreciate it. :)

sagorahmed commented 5 years ago

Yes, this issue is not occurring anymore. Thanks for fixing the issue.