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

Remove unnecessary null checks in some places #4265

Merged
merged 1 commit into from Oct 6, 2020

Conversation

KonH
Copy link
Contributor

@KonH KonH commented Oct 3, 2020

Hello!

I made a small PR to understand how that approach fits the project.

Now nullable data types are used widely inside the project, but it leads to warnings, which can be resolved (obviously, we cannot fix it in public methods, because have no guarantees about its usage, but can inspect private methods properly).

Changes

  1. GetPasswordResetProviders is called from StartForgotPasswordProcess only and that place already check user against null, so conditional access is not required

  2. OnFfMpegProcessExited is called only from StartFfMpeg, where it created from OnTranscodeBeginning, which guaranteed that it is not null, so conditional access here is not required

  3. GetMaxBitrate is called from two places, but if code passed to it, the user variable cannot be null (if it is not true, NullReferenceException already be thrown)

Issues
Related to #2149

Do you think it's a working approach for other areas of the project?
Can it help you with maintaining it?

@dkanada dkanada merged commit 3a238de into jellyfin:master Oct 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants