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
Avoid dereferencing map_get_path_element_at nullptr on libopenrct2 #10068
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think either of the changes in this pr are required
@@ -761,7 +761,7 @@ bool Peep::Place(TileCoordsXYZ location, bool apply) | |||
{ | |||
auto* pathElement = map_get_path_element_at(location); | |||
TileElement* tileElement = reinterpret_cast<TileElement*>(pathElement); | |||
if (!pathElement) | |||
if (!tileElement) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is already safe
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I figured it would be better to check for the tileElement
as it's what will be used.
@@ -9884,6 +9884,9 @@ void vehicle_update_crossings(const rct_vehicle* vehicle) | |||
while (true) | |||
{ | |||
auto* pathElement = map_get_path_element_at({ xyElement.x / 32, xyElement.y / 32, xyElement.element->base_height }); | |||
if (pathElement == nullptr) | |||
break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has already been accounted for in the function
Yeah, seems not to, I'll close it then. |
Good work anyway for exhausting all of the possibilities |
Helps #9014