Index: trunk/psLib/src/math/psStats.c
===================================================================
--- trunk/psLib/src/math/psStats.c	(revision 2778)
+++ trunk/psLib/src/math/psStats.c	(revision 2780)
@@ -9,6 +9,6 @@
  *  @author GLG, MHPCC
  *
- *  @version $Revision: 1.105 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-12-21 20:42:07 $
+ *  @version $Revision: 1.106 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2004-12-21 23:25:14 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -151,4 +151,5 @@
                          psStats* stats)
 {
+
     psS32 i = 0;                // Loop index variable
     float mean = 0.0;           // The mean
@@ -920,5 +921,7 @@
                     sumDiffs += diff;
                     countInt++;
-                    errorDivisor+= (1.0 / PS_SQR(errors->data.F32[i]));
+                    if (errors != NULL) {
+                        errorDivisor+= (1.0 / PS_SQR(errors->data.F32[i]));
+                    }
                 }
             }
@@ -931,5 +934,7 @@
                     sumDiffs += diff;
                     countInt++;
-                    errorDivisor+= (1.0 / PS_SQR(errors->data.F32[i]));
+                    if (errors != NULL) {
+                        errorDivisor+= (1.0 / PS_SQR(errors->data.F32[i]));
+                    }
                 }
             }
@@ -944,5 +949,7 @@
                     sumDiffs += diff;
                     countInt++;
-                    errorDivisor+= (1.0 / PS_SQR(errors->data.F32[i]));
+                    if (errors != NULL) {
+                        errorDivisor+= (1.0 / PS_SQR(errors->data.F32[i]));
+                    }
                 }
             }
@@ -955,5 +962,7 @@
             }
             countInt = myVector->n;
-            errorDivisor+= (1.0 / PS_SQR(errors->data.F32[i]));
+            if (errors != NULL) {
+                errorDivisor+= (1.0 / PS_SQR(errors->data.F32[i]));
+            }
         }
     }
@@ -1962,4 +1971,7 @@
 psVector* p_psConvertToF32(psVector* in)
 {
+    if (in == NULL) {
+        return(NULL);
+    }
     psS32 i = 0;
     psVector* tmp = NULL;
