Index: trunk/psLib/src/image/psImageStats.c
===================================================================
--- trunk/psLib/src/image/psImageStats.c	(revision 1939)
+++ trunk/psLib/src/image/psImageStats.c	(revision 1951)
@@ -10,6 +10,6 @@
 *  @author George Gusciora, MHPCC
 *
-*  @version $Revision: 1.38 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-09-30 23:06:36 $
+*  @version $Revision: 1.39 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-10-05 01:03:11 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -236,5 +236,5 @@
         over all pixels (x,y) in the image.
  *****************************************************************************/
-psPolynomial2D* psImageFitPolynomial(const psImage* input, psPolynomial2D* coeffs)
+psPolynomial2D* psImageFitPolynomial(psPolynomial2D* coeffs, const psImage* input)
 {
     int x = 0;
@@ -247,4 +247,19 @@
     float *cScalingFactors = NULL;
     float *rScalingFactors = NULL;
+
+    // Check for null inputs
+    if (input == NULL) {
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageFitPolynomial",
+                   PS_ERR_BAD_PARAMETER_NULL, true,
+                   PS_ERRORTEXT_psImage_IMAGE_NULL);
+        return NULL;
+    }
+
+    if (coeffs == NULL) {
+        psErrorMsg(PS_ERRORNAME_DOMAIN "psImageFitPolynomial",
+                   PS_ERR_BAD_PARAMETER_NULL, true,
+                   PS_ERRORTEXT_psImage_COEFF_NULL);
+        return NULL;
+    }
 
     // Create the sums[][] data structure.  This
