Index: trunk/psModules/src/astrom/pmAstrometryWCS.c
===================================================================
--- trunk/psModules/src/astrom/pmAstrometryWCS.c	(revision 19306)
+++ trunk/psModules/src/astrom/pmAstrometryWCS.c	(revision 19509)
@@ -7,6 +7,6 @@
  *  @author EAM, IfA
  *
- *  @version $Revision: 1.28 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2008-09-02 19:05:33 $
+ *  @version $Revision: 1.29 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2008-09-12 01:05:59 $
  *
  *  Copyright 2006 Institute for Astronomy, University of Hawaii
@@ -117,4 +117,9 @@
 {
     pmAstromWCS *wcs = pmAstromWCSBilevelChipFromFPA (chip, tol);
+    if (!wcs) {
+        psError(PS_ERR_UNKNOWN, false, "failure to determine WCS terms from fpa");
+        return false;
+    }
+
     pmAstromWCStoHeader (header, wcs);
 
@@ -128,4 +133,8 @@
 {
     pmAstromWCS *wcs = pmAstromWCSBilevelMosaicFromFPA (fpa, tol);
+    if (!wcs) {
+        psError(PS_ERR_UNKNOWN, false, "failure to determine WCS terms from fpa");
+        return false;
+    }
 
     // we need to specify the dimensions of the FPA
@@ -230,5 +239,5 @@
     if (cdKeys && pcKeys) {
         // XXX make this an option
-        psLogMsg ("psastro", 2, "warning: both CDi_j and PC00i00j defined in headers, using PC00i00j terms\n");
+        psLogMsg ("psastro", 5, "warning: both CDi_j and PC00i00j defined in headers, using PC00i00j terms\n");
     }
     if (!cdKeys && !pcKeys) {
@@ -615,4 +624,10 @@
     // given transformation, solve for coordinates which yields output coordinates of 0,0
     psPlane *center = psPlaneTransformGetCenter (toTPA, tol);
+    if (!center) {
+	psError(PS_ERR_UNKNOWN, false, "Unable to solve for TPA center.");
+	psFree (toTPA);
+	psFree (wcs);
+	return NULL;
+    }
 
     // create wcs transform from toFPA, resulting transformation has units of microns/pixel
@@ -671,4 +686,9 @@
     // given transformation, solve for coordinates which yields output coordinates of 0,0
     psPlane *center = psPlaneTransformGetCenter (chip->toFPA, tol);
+    if (!center) {
+    	psError(PS_ERR_UNKNOWN, false, "Unable to solve for TPA center.");
+    	psFree (wcs);
+    	return NULL;
+    }
 
     // adjust wcs transform to use center as reference coordinate
@@ -707,4 +727,9 @@
     // given transformation, solve for coordinates which yields output coordinates of 0,0
     psPlane *center = psPlaneTransformGetCenter (fpa->toTPA, tol);
+    if (!center) {
+	psError(PS_ERR_UNKNOWN, false, "Unable to solve for TPA center.");
+	psFree (wcs);
+	return NULL;
+    }
 
     // adjust wcs transform to use center as reference coordinate
