Fix crash in l_body_get_ground_position if there is no body to get po…#5665
Fix crash in l_body_get_ground_position if there is no body to get po…#5665sturnclaw merged 3 commits intopioneerspacesim:masterfrom
Conversation
…sition relative to
|
I haven't considered that this can happen when doing |
|
Hey @Max5377 , thanks for looking at this. I think a frame reference with no body attached is fine and so we probably should still return that frame. I'm not really across all the details here so if you'd like to progress this, how about you create a PR from your branch and then I'll close this one? |
|
@JonBooth78 You can also give write access to your repo by doing this I could also do PR to your branch, but I don't know if this would cause merge conflicts, because from the looks you haven't synced your fork in a long time. |
1. Added null check for relTo in Body::GetAltitudeRelTo; 2. Added null check for frameBody in Ship:GetGPS. Co-Authored-By: JonBooth78 <249391+jonbooth78@users.noreply.github.com> (cherry picked from commit 2cfbb42)
|
Hey @Max5377,I know how to pull more of your changes into this PR and I've done it for now. I'm just a bit concerned if there are more changes at code review, I might slow things down :-) If you wanted to do a PR into my repo, you wouldn't want to do it to my |
src/lua/LuaBody.cpp
Outdated
| if (!astro) | ||
| { | ||
| lua_pushnil(l); | ||
| return 1; | ||
| } |
There was a problem hiding this comment.
As a nitpick for both @JonBooth78 and @Max5377 - Pioneer's codebase prefers the use of starting braces on the same line for if and for statements, as well as class/struct definitions and single-line function definitions. Multi-line function definitions should (assuming I haven't forgotten anything) be the only structure with their beginning brace on a newline.
The clang-format CI check would be complaining at you over this... if it hadn't been silently broken for quite some time and I didn't notice. 😐
|
Ahh, man sorry @Web-eWorks , tidied those up for you now :-) I'll also update my VS pro settings to remind me! |
Mostly tidy up open scope braces to be on the same line (except for functions)
3261098 to
006a844
Compare
…sition relative to
Every time I try to hyperspace I was crashing here (jumping from a space station, if that matters). Well the crash happened in
GetAltitudeRelTowhich was being passed anullbody as the first argument.@Max5377 , I think this relates to your earlier PR.