Protected against buffer overflow (and resulting crash) that occurred when displaying the luminosity of stars with very high absolute magnitudes.

ver1_5_1
Chris Laurel 2004-11-12 08:31:44 +00:00
parent 3c3425ef60
commit 2168046eb3
1 changed files with 3 additions and 1 deletions

View File

@ -2710,7 +2710,9 @@ static void displayStarInfo(Overlay& overlay,
star.getAbsoluteMagnitude(),
astro::absToAppMag(star.getAbsoluteMagnitude(),
(float) distance));
overlay << "Luminosity: " << SigDigitNum(star.getLuminosity(), 3) << "x Sun\n";
if (star.getLuminosity() > 1.0e-10f)
overlay << "Luminosity: " << SigDigitNum(star.getLuminosity(), 3) << "x Sun\n";
overlay << "Class: ";
if (star.getSpectralType()[0] == 'Q')
overlay << "Neutron star";