Fixed bug 1923254 "invisible planet crashes Celestia". The code to pick the preferred distance from a reference point wasn't checking for the case when the point had no child objects. A simple check for NULL fixed the problem.

ver1_6_1
Chris Laurel 2008-03-23 19:57:26 +00:00
parent 9303aa6028
commit 1033c3a7e4
1 changed files with 3 additions and 1 deletions

View File

@ -1043,7 +1043,9 @@ static double getPreferredDistance(const Selection& selection)
// a viewpoint in which the entire system can be seen.
if (selection.body()->getClassification() == Body::Invisible)
{
double r = selection.body()->getFrameTree()->boundingSphereRadius();
double r = selection.body()->getRadius();
if (selection.body()->getFrameTree() != NULL)
r = selection.body()->getFrameTree()->boundingSphereRadius();
return min(astro::lightYearsToKilometers(0.1), r * 5.0);
}
else