Index: trunk/psModules/src/astrom/pmAstrometryObjects.c
===================================================================
--- trunk/psModules/src/astrom/pmAstrometryObjects.c	(revision 11676)
+++ trunk/psModules/src/astrom/pmAstrometryObjects.c	(revision 11762)
@@ -8,6 +8,6 @@
 *  @author EAM, IfA
 *
-*  @version $Revision: 1.25 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2007-02-07 01:31:40 $
+*  @version $Revision: 1.26 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2007-02-13 03:14:42 $
 *
 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -36,5 +36,5 @@
 /******************************************************************************
 pmAstromObjSortByMag(**a, **b): sort by mag (descending)
- 
+
 Is this a private routine?
 Should we do the early asserts?
@@ -454,5 +454,5 @@
 AstromGridBin(*dx, *dy, dX, dY): local function to convert x,y coords to grid
 bins it requires the globals defined above.
- 
+
  ******************************************************************************/
 static bool AstromGridBin(
@@ -567,5 +567,14 @@
         // find the max pixel
         psStats *imStats = psStatsAlloc (PS_STAT_MAX | PS_STAT_MAX | PS_STAT_SAMPLE_MEDIAN | PS_STAT_SAMPLE_STDEV);
-        imStats = psImageStats (imStats, gridNP, NULL, 0);
+        if (!psImageStats(imStats, gridNP, NULL, 0)) {
+            psError(PS_ERR_UNKNOWN, false, "Unable to get image statistics.\n");
+            psFree(imStats);
+            psFree(gridNP);
+            psFree(gridDX);
+            psFree(gridDY);
+            psFree(gridD2);
+            psFree(stats);
+            return NULL;
+        }
 
         # if 0
@@ -860,5 +869,5 @@
    +15:+25 -> 5
    +25:+35 -> 6
- 
+
    maxOffsetRequest = 30
    nPix = (int) (maxOffset / dPix + 0.5);
