Don't hurt user's feelings by crashing on attempts to load a complete junk.
Maybe he didn't mean it and you'd regret it one day.

Lubomir Rintel <lkundrak@v3.sk>

diff -up spacechart-0.9.5/src/star_catalog.c.format spacechart-0.9.5/src/star_catalog.c
--- spacechart-0.9.5/src/star_catalog.c.format	2009-04-06 17:47:13.000000000 +0200
+++ spacechart-0.9.5/src/star_catalog.c	2009-04-06 17:54:35.000000000 +0200
@@ -95,7 +95,7 @@ int star_catalog_read( star_catalog_t* c
                 /* Before reading the stars we read the header. It is supposed
                  * to contain data the user should know */
                 old_length = 0;
-                while(  (fgets( tmp, 256, data_file )[0]) &&
+                while(  fgets( tmp, 256, data_file ) &&
                        tmp[0] != '%' )
                 {
                         length = strlen(tmp);
@@ -116,6 +116,12 @@ int star_catalog_read( star_catalog_t* c
                 }
                 catalog->filename = basename(file);
 
+                if( feof( data_file ) )
+                {
+                        /* No header end found yet and we've encountered EOF */
+                        error = 2;
+                }
+
                 while( !error )
                 {
                         star = star_new();
