[Kstars-devel] branches/kstars/summer/kdeedu/kstars/kstars/skycomponents

Akarsh Simha akarshsimha at gmail.com
Thu Jul 10 22:39:34 CEST 2008


SVN commit 830616 by asimha:

Add useful debugging statements to highpmstarlist.cpp to prevent
coding errors.

CCMAIL: kstars-devel at kde.org



 M  +11 -1     highpmstarlist.cpp  


--- branches/kstars/summer/kdeedu/kstars/kstars/skycomponents/highpmstarlist.cpp #830615:830616
@@ -47,6 +47,9 @@
 {
     if ( pm < m_threshold ) return false;
 
+    if( trixel >= m_skyMesh->size() || trixel < 0 )
+        kDebug() << "### Trixel ID out of range for the Mesh currently in use!" << trixel;
+
     m_stars.append( new HighPMStar( trixel, star ) );
     if ( m_maxPM >= pm ) return true;
 
@@ -79,14 +82,21 @@
         StarObject* star = HPStar->star;
 
         // out with the old ...
+        if( HPStar->trixel < 0 || HPStar->trixel >= m_skyMesh->size() ) {
+            kDebug() << "### Expect an Index out-of-range error. star->trixel =" << HPStar->trixel;
+        }
+            
         StarList *old = starIndex->at( HPStar->trixel );
         old->removeAt( old->indexOf( star ) );
-
+            
         float mag = star->mag();
         //printf("\n mag = %4.2f  trixel %d -> %d\n", mag, HPStar->trixel, trixel );
 
         // in with the new ...
         HPStar->trixel = trixel;
+        if( trixel < 0 || trixel >= m_skyMesh->size() )
+            kDebug() << "### Expect an Index out-of-range error. trixel =" << trixel;
+                
         StarList *list = starIndex->at( trixel );
         int j;
         for ( j = 0; j < list->size(); j++ ) {


More information about the Kstars-devel mailing list