Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NewPipe crashes when re-opening a previously played video/livestream due to a NullPointerException #6652

Closed
4 tasks done
ageneric opened this issue Jul 12, 2021 · 4 comments
Closed
4 tasks done
Labels
bug Issue is related to a bug player Issues related to any player (main, popup and background)

Comments

@ageneric
Copy link

ageneric commented Jul 12, 2021

Checklist

Purpose

This issue is intended to report the NullPointerException that occurs when player.playqueue.PlayQueueItem.getRecoveryPosition() is invoked, and the logs corresponds to this crash. In the initial report the error occurred after a different crash, which is mentioned for the sake of reproducibility (I did not open an issue for this crash as I did not keep the log).

Steps to reproduce the bug

The same error has occurred twice, however I am unable to reproduce the bug following either case. In each case the actions leading up to the crash are listed below:

Re-opening an ended live stream (0.21.5, initial report)

  1. Viewed a live stream (YouTube) using NewPipe. The live stream ended* at approximately the same time as it was opened, and the player only showed less than 5 seconds from the end of the stream.
  2. Exited video using the back button. A toast was displayed with the message "Could not play stream". I do not remember if it occurs during this step, or in the next step when NewPipe is unfocused.
  3. Unfocus the app then attempt to close it. NewPipe crashes (this is a different crash, and not covered by this issue) and brings up the bug reporting screen. Exit the bug reporting screen and close NewPipe.
  4. Re-open the app. The error now occurs.

*The live stream was set to upload as video after ending.

Re-opening an unlisted video (0.21.8)

  1. Played an unlisted YouTube video* from a link using NewPipe. The app may have been open already, so I am not certain if this was the earliest video in the stack, but it was the most recent.
  2. Unfocus the app. NewPipe displayed the video on the lock screen (not playing), so the application was open but not visible.
  3. Re-open the app. The error now occurs.

*The unlisted video still exists and was not removed.

Actual behavior

On opening NewPipe, NewPipe immediately crashes and brings up the bug reporting screen. In both cases the crash log is identical except for the Version field (but you can find the more recent log in the comment below).

Expected behavior

The video/livestream is re-opened without an error.

Logs

Error on app open following "Could not play stream" toast message and closing app. Produced on non-root Android Marshmallow. Not logged in.

Exception

  • User Action: ui error
  • Request: ACRA report
  • Content Country: GB
  • Content Language: en-GB
  • App Language: en_GB
  • Service: none
  • Version: 0.21.5
  • OS: Linux ,release-keys 6.0 - 23
Crash log

java.lang.NullPointerException: Attempt to invoke virtual method 'long org.schabi.newpipe.player.playqueue.PlayQueueItem.getRecoveryPosition()' on a null object reference
	at org.schabi.newpipe.fragments.detail.VideoDetailFragment.updateProgressInfo(VideoDetailFragment.java:1644)
	at org.schabi.newpipe.fragments.detail.VideoDetailFragment.handleResult(VideoDetailFragment.java:1547)
	at org.schabi.newpipe.fragments.detail.VideoDetailFragment.lambda$runWorker$6(VideoDetailFragment.java:893)
	at org.schabi.newpipe.fragments.detail.VideoDetailFragment.lambda$runWorker$6$VideoDetailFragment(VideoDetailFragment.java)
	at org.schabi.newpipe.fragments.detail.-$$Lambda$VideoDetailFragment$X-UcNln23jPsop2TvHe2VPTu0NQ.accept(lambda)
	at io.reactivex.rxjava3.internal.observers.ConsumerSingleObserver.onSuccess(ConsumerSingleObserver.java:62)
	at io.reactivex.rxjava3.internal.operators.single.SingleObserveOn$ObserveOnSingleObserver.run(SingleObserveOn.java:81)
	at io.reactivex.rxjava3.android.schedulers.HandlerScheduler$ScheduledRunnable.run(HandlerScheduler.java:123)
	at android.os.Handler.handleCallback(Handler.java:746)
	at android.os.Handler.dispatchMessage(Handler.java:95)
	at android.os.Looper.loop(Looper.java:148)
	at android.app.ActivityThread.main(ActivityThread.java:5443)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)


Device info

  • Android version: 6.0
  • Device model: Motorola E (2nd Generation)
@ageneric ageneric added the bug Issue is related to a bug label Jul 12, 2021
@ageneric ageneric changed the title Playing a live stream that ends at the same time causes crash on next open After playing a live stream as it ends, NewPipe crashes when next opened Jul 13, 2021
@triallax triallax added the player Issues related to any player (main, popup and background) label Jul 15, 2021
@ageneric
Copy link
Author

ageneric commented Aug 18, 2021

I had the same error occur on NewPipe 0.21.8 using the same device, when restoring an unlisted YouTube video. NewPipe displayed the video on the lock screen (not playing), so the application was open but not visible. Again it crashed immediately when opened.

Note: The crash log is identical apart from the Version field.

Exception

  • User Action: ui error
  • Request: ACRA report
  • Content Country: GB
  • Content Language: en-GB
  • App Language: en_GB
  • Service: none
  • Version: 0.21.8
  • OS: Linux ,release-keys 6.0 - 23
Crash log

java.lang.NullPointerException: Attempt to invoke virtual method 'long org.schabi.newpipe.player.playqueue.PlayQueueItem.getRecoveryPosition()' on a null object reference
	at org.schabi.newpipe.fragments.detail.VideoDetailFragment.updateProgressInfo(VideoDetailFragment.java:1644)
	at org.schabi.newpipe.fragments.detail.VideoDetailFragment.handleResult(VideoDetailFragment.java:1547)
	at org.schabi.newpipe.fragments.detail.VideoDetailFragment.lambda$runWorker$6(VideoDetailFragment.java:893)
	at org.schabi.newpipe.fragments.detail.VideoDetailFragment.lambda$runWorker$6$VideoDetailFragment(VideoDetailFragment.java)
	at org.schabi.newpipe.fragments.detail.-$$Lambda$VideoDetailFragment$X-UcNln23jPsop2TvHe2VPTu0NQ.accept(lambda)
	at io.reactivex.rxjava3.internal.observers.ConsumerSingleObserver.onSuccess(ConsumerSingleObserver.java:62)
	at io.reactivex.rxjava3.internal.operators.single.SingleObserveOn$ObserveOnSingleObserver.run(SingleObserveOn.java:81)
	at io.reactivex.rxjava3.android.schedulers.HandlerScheduler$ScheduledRunnable.run(HandlerScheduler.java:123)
	at android.os.Handler.handleCallback(Handler.java:746)
	at android.os.Handler.dispatchMessage(Handler.java:95)
	at android.os.Looper.loop(Looper.java:148)
	at android.app.ActivityThread.main(ActivityThread.java:5443)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)


@ageneric ageneric changed the title After playing a live stream as it ends, NewPipe crashes when next opened NewPipe crashes when re-opening a previously played video/livestream due to a NullPointerException Aug 18, 2021
@litetex
Copy link
Member

litetex commented Sep 3, 2021

Note that a similar error now starts occurring on https://github.com/TeamNewPipe/NewPipe/blob/v0.21.9/app/src/main/java/org/schabi/newpipe/player/Player.java#L674

There seems to be a shared underlying cause as the error messages are identical.
In both cases Attempt to invoke virtual method 'long org.schabi.newpipe.player.playqueue.PlayQueueItem.getRecoveryPosition()' on a null object reference happens because the stream is outside a valid index:
https://github.com/TeamNewPipe/NewPipe/blob/v0.21.9/app/src/main/java/org/schabi/newpipe/player/playqueue/PlayQueue.java#L169-L187

@licaon-kter
Copy link
Contributor

Seeing this most of the time with latest version.

Kinda fixed if I FC the app and clean cache. On reopen same video just works fine.

@ShareASmile
Copy link
Collaborator

Closing as fixed as no recent reports found for such error.

Comment here if case is otherwise and I will reopen it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue is related to a bug player Issues related to any player (main, popup and background)
Projects
None yet
Development

No branches or pull requests

5 participants