Index: /trunk/Ohana/src/addstar/src/find_matches_closest.c
===================================================================
--- /trunk/Ohana/src/addstar/src/find_matches_closest.c	(revision 8303)
+++ /trunk/Ohana/src/addstar/src/find_matches_closest.c	(revision 8304)
@@ -1,3 +1,4 @@
 # include "addstar.h"
+# define DEBUG 1
 
 void find_matches_closest (SkyRegion *region, Stars *stars, int Nstars, Catalog *catalog, Image *image, Image *overlap, int Noverlap, Coords *mosaic, AddstarClientOptions options) {
@@ -95,4 +96,12 @@
   /** find matched stars **/
   for (i = j = 0; (i < Nstars) && (j < Nave); ) {
+    if (!finite(X1[i]) || !finite(Y1[i])) { 
+      i++; 
+      continue;
+    }
+    if (!finite(X2[j]) || !finite(Y2[j])) { 
+      j++; 
+      continue;
+    }
     
     /* negative dX: j is too large */
@@ -140,4 +149,8 @@
     n = N2[Jmin];
     N = N1[i];
+
+    if (DEBUG) fprintf (stderr, "matched %f,%f and %f,%f\n", 
+			catalog[0].average[n].R, catalog[0].average[n].D,
+			stars[N].R, stars[N].D);
 
     /* add to end of measurement list */
