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

fix(clcore): Adjust "==" and "!=" operators to fix null reference exceptions #2679

Merged
merged 1 commit into from
Aug 13, 2024

Conversation

Keyinator
Copy link
Contributor

@Keyinator Keyinator commented Jul 28, 2024

Goal of this PR

Fix potential null reference exceptions in clcore.

How is this PR achieving the goal

Instead of using left.Equals(right) where left could be null, leading to a null reference exception, we check both left and right for being null before.

This PR applies to the following area(s)

FiveM, RedM, Client, ScRT: C#

Successfully tested on

Checklist

  • Code compiles and has been tested successfully.
  • Code explains itself well and/or is documented.
  • My commit message explains what the changes do and what they are for.
  • No extra compilation warnings are added by these changes.

Fixes issues

fixes #1312

@github-actions github-actions bot added RedM Issues/PRs related to RedM ScRT: C# Issues/PRs related to either C# scripting runtimes invalid Requires changes before it's considered valid and can be (re)triaged labels Jul 28, 2024
@Keyinator
Copy link
Contributor Author

The errors from the action don't seem to be caused by my code if I am not mistaken

@DaniGP17
Copy link

Yeah, for me is compiling well

@github-actions github-actions bot added triage Needs a preliminary assessment to determine the urgency and required action and removed invalid Requires changes before it's considered valid and can be (re)triaged labels Aug 1, 2024
Copy link
Contributor

@jakub-cfx jakub-cfx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Compiled just fine locally, tested by joining a game on b2802 and fiddling around with a couple of C# resources, everything worked as expected.

@jakub-cfx jakub-cfx added ready-to-merge This PR is enqueued for merging and removed triage Needs a preliminary assessment to determine the urgency and required action labels Aug 9, 2024
@prikolium-cfx prikolium-cfx merged commit 2fa6605 into citizenfx:master Aug 13, 2024
11 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-to-merge This PR is enqueued for merging RedM Issues/PRs related to RedM ScRT: C# Issues/PRs related to either C# scripting runtimes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"==" throwing null reference exception on Models which are null
4 participants