Index: trunk/psLib/test/image/tst_psImageStats02.c
===================================================================
--- trunk/psLib/test/image/tst_psImageStats02.c	(revision 1811)
+++ trunk/psLib/test/image/tst_psImageStats02.c	(revision 1952)
@@ -26,4 +26,5 @@
     psImage *outImage = NULL;
     psPolynomial2D *my2DPoly = NULL;
+    psPolynomial2D *null2DPoly = NULL;
     int testStatus = true;
     int memLeaks = 0;
@@ -54,9 +55,21 @@
                              "Calculate Chebyshev Polynomials, no mask" );
 
-    my2DPoly = psImageFitPolynomial( tmpImage, my2DPoly );
+    my2DPoly = psImageFitPolynomial( my2DPoly, tmpImage );
     for ( i = 0;i < CHEBY_X_DIM;i++ ) {
         for ( j = 0;j < CHEBY_Y_DIM;j++ ) {
             printf( "Cheby Polynomial (%d, %d) coefficient is %.2f\n", i, j, 0.0001f+my2DPoly->coeff[ i ][ j ] );
         }
+    }
+
+    psLogMsg(__func__,PS_LOG_INFO,"Following should be an error message for NULL coeffs argument.");
+    null2DPoly = psImageFitPolynomial( NULL, tmpImage );
+    if ( null2DPoly != NULL ) {
+        printf("ERROR: psImageFitPolynomial did not return NULL with invalid coeffs argument.");
+    }
+
+    psLogMsg(__func__,PS_LOG_INFO,"Following should be a error message for NULL input argument.");
+    null2DPoly = psImageFitPolynomial( null2DPoly, NULL );
+    if ( null2DPoly != NULL ) {
+        printf("ERROR: psImageFitPolynomial did not return NULL with null input image.");
     }
 
