-
-
Notifications
You must be signed in to change notification settings - Fork 128
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
Fix Crash When Options Button Pressed, but Options Are Not Available #921
Fix Crash When Options Button Pressed, but Options Are Not Available #921
Conversation
fixes crash when pressing back during initial video buffering
why do you feel that isValid() is superior to <> invalid? |
I feel it’s more intuitive than We’re using using a mix of the two right now, but we should probably pick one and standardize. I’ve seen more preference for |
We had a whole discussion (pros/cons) about this in the chat room when I first wrote it. It helps improve readability at a glance, which in turn improves long term maintainability. The basic idea is removing negatives from conditions as part of our code style. Ref: https://www.codeproject.com/articles/1073387/robert-s-rules-of-coders-sharp-avoid-negative-cond |
@ApexArray I'm unable to recreate the issue. The title says it occurs when pressing back, but your code change is inside a handler for pressing options. What are the steps to recreate? |
@1hitsong you're right, I must have gotten mixed up. It's actually crashing when pressing options button. To reproduce, start playing any video and immediately press the options button. It's more prevalent in videos that require transcoding since they take longer to buffer initially. Are you able to reproduce with that? |
Nope. I can't get this issue to fire. Perhaps Jimi or Neil can. |
@ApexArray I'm not able to reproduce the crash on 1.6.2 either. I tried movies, 4k movies, 4k shows, tv shows and live tv. I pressed the "*" several times while the video was buffering and did not receive a crash. |
@ApexArray Are you sure this is the source of the crash? Can you cause the crash on your machine and post the console output? What reason I ask is I tested this by hardcoding group.optionsAvailable to invalid and everything worked as expected in |
It's reliably fired on all my TV Shows and movies so far. I tested with multiple qualities, codecs, transcoding/direct stream and I get the same result every time. The only difference I can think of at this point is that I'm testing with an older Roku 4200X.
EDIT: Confirmed the issue is NOT present on my 3800x. JFVideo gets focus right away, so it never hits the affected code in JFScene. |
Okay, sorry for spamming a bit here but I keep coming across new information. @1hitsong's test should have reproduced my condition, but it seems that there's more than one kind of "invalid" in Brightscript. I can reproduce the exact output as long as For example, pressing options from the home screen: But I still get the crash if I press it during buffering. Line 14 has no effect in my case (property is not added), and it continues to crash. Apparently an "existing" invalid is different from a "non-existing" invalid. This means I'm likely pulling a different group than you guys during buffering. I added some debug code to Printed output during crash
My JFScene is still in focus during buffering and pulls JFVideo from m.groups, but we're not setting an This PR fixes that by checking whether optionsAvailable exists before we evaluate it. EDIT: Again, I confirmed the issue is NOT present on my 3800x. JFVideo gets focus right away, so it never hits the affected code in JFScene. The issue only occurs on my 4200x. |
I was able to test this by overriding group without an Unstable crashes. This PR prevents the crash and doesn't show the options menu. |
Pressing the
backoptions button during initial video buffering may trigger this code with a group not containingoptionsAvailable
property, leading to a crash. In my case, the entire Roku device crashed and reset.Changes
Checks if
group.optionsAvailable
is valid before we observe it.Converts another
<> invalid
check toisValid()