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 an unnecessary null pointer check #6

Closed
elfring opened this issue Mar 19, 2020 · 5 comments
Closed

Remove an unnecessary null pointer check #6

elfring opened this issue Mar 19, 2020 · 5 comments

Comments

@elfring
Copy link

elfring commented Mar 19, 2020

An extra null pointer check is not needed in a function like the destructor for the class “VertData”.

@fegennari
Copy link
Owner

Thanks. This isn't my code, I copied it from another project, but it's easy to change. I'm not sure if there are any more of these or how to find them.

@elfring
Copy link
Author

elfring commented Mar 20, 2020

@fegennari
Copy link
Owner

Thanks, I'll look into this. There seems to be an option to run this in Visual Studio.

@elfring
Copy link
Author

elfring commented Mar 20, 2020

Thanks for your small source code improvement.

@fegennari
Copy link
Owner

I removed the setting of triIndex back to NULL. I'm not sure it really matters. Sometimes it's useful to leave that in because it causes less trouble if that class is used after free. I have code like that to check for use-after-free in my universe ship logic, which has quite a complex object ownership/reference counting system due to the reference cycles between ships.

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

No branches or pull requests

2 participants