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

[Bug] NullReferenceException occurs on events when no VideoStateOptions is configured. #31

Open
Mike-FB opened this issue Nov 30, 2023 · 1 comment
Labels
Bug Something isn't working Triage Issue needs to be triaged

Comments

@Mike-FB
Copy link

Mike-FB commented Nov 30, 2023

Describe the bug
When an event occurs while no VideoStateOptions is set up for the current BlazoredVideo component, a System.NullReferenceException is thrown, caught, and logged in BlazoredVideo.OnChange on line 202.
This seems to be because videoData.State is null after being deserialized.
I would imagine the fix is to either always initialize the property in the VideoEventData constructor, or not attempt to set the videoData.State.Video property when videoData.State is null.

To Reproduce
Steps to reproduce the behavior:

  1. Go to the file 'AllEventsAllOptions.razor' in the project 'SharedRCL' from your own samples.
  2. Change the first line in OnInitialized to var allOptionsEnabled = new VideoStateOptions() { All = false };, setting All from true to false.
  3. Open the devtools and look in console. There should be an System.NullReferenceException.

Expected behavior
I would expect it would not attempt to set a property on a null object or that the resulting NullReferenceException is not logged.

Screenshots
image

Hosting Model (is this issue happening with a certain hosting model?):

  • Blazor WebAssembly
@Mike-FB Mike-FB added Bug Something isn't working Triage Issue needs to be triaged labels Nov 30, 2023
@isaranghi
Copy link

I am having the save issue.... I am trying to get the VideoState OnTimeUpdate (as discribed in the readme) and it's always null...
I am using

.Net 8
Blazor Server (InteractiveServer) is having the issue
Blazor Standalone is having the issue too

any solutions?

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Triage Issue needs to be triaged
Projects
None yet
Development

No branches or pull requests

2 participants