[Kstars-devel] branches/KDE/3.5/kdeedu/kstars/kstars
Jason Harris
kstars at 30doradus.org
Sun Jan 27 00:16:38 CET 2008
SVN commit 766927 by harris:
Fixing crash condition in SkyMap::refract(). The
array index could sometimes go out of bounds, leading
to a segfault.
Will port to trunk and 4.0 branch
BUG: 133505
CCMAIL: kstars-devel at kde.org
M +3 -0 ksmoon.cpp
M +5 -0 skymap.cpp
--- branches/KDE/3.5/kdeedu/kstars/kstars/ksmoon.cpp #766926:766927
@@ -186,6 +186,9 @@
sPhase = sPhase.sprintf( "%02d", iPhase );
QString imName = "moon" + sPhase + ".png";
+ //DEBUG
+ kdDebug() << "Moon phase: " << Phase.Degrees() << ": " << iPhase << " " << imName << endl;
+
QFile imFile;
if ( KSUtils::openDataFile( imFile, imName ) ) {
imFile.close();
--- branches/KDE/3.5/kdeedu/kstars/kstars/skymap.cpp #766926:766927
@@ -1147,6 +1147,11 @@
int index = int( ( alt->Degrees() + 2.0 )*2. ); //RefractCorr arrays start at alt=-2.0 degrees.
dms result;
+ //Failsafe: if the index is out of range, return the original angle
+ if ( index < 0 || index > 183 ) {
+ return dms( alt->Degrees() );
+ }
+
if ( findApparent ) {
result.setD( alt->Degrees() + RefractCorr1[index] );
} else {
More information about the Kstars-devel
mailing list