[Kstars-devel] KDE/kdeedu/kstars/kstars/skycomponents

Jason Harris kstars at 30doradus.org
Tue Jan 31 15:49:41 CET 2006


SVN commit 504239 by harris:

Fix the runtime error repoorted by Pablo.  In DeepSkyComponent, it was 
possible to read from a KSFileReader object without checking 
hasMoreLines()

CCMAIL: kstars-devel at kde.org


 M  +7 -1      deepskycomponent.cpp  


--- trunk/KDE/kdeedu/kstars/kstars/skycomponents/deepskycomponent.cpp #504238:504239
@@ -57,6 +57,9 @@
 		QString fname = QString().sprintf( "ngcic%02d.dat", i+1 );
 
 		if ( KSUtils::openDataFile( file, fname ) ) {
+		  //DEBUG
+		  kdDebug() << "File: " << fname << endl;
+
 			KSFileReader fileReader( file ); // close file is included
 			while ( fileReader.hasMoreLines() ) {
 				QString line, con, ss, name, name2, longname;
@@ -70,7 +73,7 @@
 				//Ignore comment lines
 				while ( line.at(0) == '#' && fileReader.hasMoreLines() ) line = fileReader.readLine();
 				//Ignore lines with no coordinate values
-				while ( line.mid(6,8).trimmed().isEmpty() ) line = fileReader.readLine();
+				while ( line.mid(6,8).trimmed().isEmpty() && fileReader.hasMoreLines() ) line = fileReader.readLine();
 				
 				iflag = line.at( 0 ); //check for NGC/IC catalog flag
 				if ( iflag == 'I' ) cat = "IC";
@@ -157,6 +160,9 @@
 				o = new DeepSkyObject( type, r, d, mag, name, name2, longname, cat, a, b, pa, pgc, ugc );
 				o->EquatorialToHorizontal( data->lst(), data->geo()->lat() );
 
+				//DEBUG
+				kdDebug() << o->name() << endl;
+
 //FIXME: do we need a master deep sky object list?
 //				// keep object in deep sky objects' list
 //				deepSkyList.append( o );


More information about the Kstars-devel mailing list