Index: /trunk/psLib/src/image/psImageErrors.dat
===================================================================
--- /trunk/psLib/src/image/psImageErrors.dat	(revision 1950)
+++ /trunk/psLib/src/image/psImageErrors.dat	(revision 1951)
@@ -73,3 +73,4 @@
 psImageConvolve_FFT_FAILED             Failed to perform a fourier transform of input image.
 psImageConvolve_KERNEL_FFT_FAILED      Failed to perform a fourier transform of kernel.
-psImageConvolve_KERNEL_TOO_LARGE       Specified psKernel size, %dx%d, can not be larger than input psImage size, %dx%d.  
+psImageConvolve_KERNEL_TOO_LARGE       Specified psKernel size, %dx%d, can not be larger than input psImage size, %dx%d. 
+psImage_COEFF_NULL                     Polynomial coefficients cannot be NULL. 
Index: /trunk/psLib/src/image/psImageStats.c
===================================================================
--- /trunk/psLib/src/image/psImageStats.c	(revision 1950)
+++ /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
Index: /trunk/psLib/src/image/psImageStats.h
===================================================================
--- /trunk/psLib/src/image/psImageStats.h	(revision 1950)
+++ /trunk/psLib/src/image/psImageStats.h	(revision 1951)
@@ -9,6 +9,6 @@
 *  @author George Gusciora, MHPCC
 *
-*  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-08-10 01:55:34 $
+*  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-10-05 01:03:11 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -68,6 +68,6 @@
  */
 psPolynomial2D* psImageFitPolynomial(
-    const psImage* input,              ///< image to fit
-    psPolynomial2D* coeffs             ///< coefficient structure carries in desired terms & target
+    psPolynomial2D* coeffs,            ///< coefficient structure carries in desired terms & target
+    const psImage* input
 );
 
Index: /trunk/psLib/src/imageops/psImageStats.c
===================================================================
--- /trunk/psLib/src/imageops/psImageStats.c	(revision 1950)
+++ /trunk/psLib/src/imageops/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
Index: /trunk/psLib/src/imageops/psImageStats.h
===================================================================
--- /trunk/psLib/src/imageops/psImageStats.h	(revision 1950)
+++ /trunk/psLib/src/imageops/psImageStats.h	(revision 1951)
@@ -9,6 +9,6 @@
 *  @author George Gusciora, MHPCC
 *
-*  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
-*  @date $Date: 2004-08-10 01:55:34 $
+*  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
+*  @date $Date: 2004-10-05 01:03:11 $
 *
 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -68,6 +68,6 @@
  */
 psPolynomial2D* psImageFitPolynomial(
-    const psImage* input,              ///< image to fit
-    psPolynomial2D* coeffs             ///< coefficient structure carries in desired terms & target
+    psPolynomial2D* coeffs,            ///< coefficient structure carries in desired terms & target
+    const psImage* input
 );
 
