Index: trunk/psLib/src/image/psImageStats.c
===================================================================
--- trunk/psLib/src/image/psImageStats.c	(revision 889)
+++ trunk/psLib/src/image/psImageStats.c	(revision 895)
@@ -20,7 +20,5 @@
 /// This routine must determine the various statistics for the image.
 /*****************************************************************************
-    GUS: verify that image/mask have the
- correct types
- sizes
+    GUS: verify that image/mask have the correct types, and sizes.
  *****************************************************************************/
 psStats *psImageStats(psStats *stats,
@@ -35,4 +33,14 @@
     int j = 0;
 
+    // GUS: Verify this action.
+    if ((stats == NULL) ||
+            (in == NULL)) {
+        return(NULL);
+    }
+    // GUS: Verify this action.
+    if (stats->options == 0) {
+        return(stats);
+    }
+
     junkData = psVectorAlloc(in->numRows * in->numCols, in->type.type);
     junkData->n = junkData->nalloc;
@@ -64,7 +72,5 @@
         stats = psVectorStats(stats, junkData, NULL, 0);
     }
-
     psVectorFree(junkData);
-
     return(stats);
 }
@@ -73,8 +79,5 @@
     NOTE: We assume that the psHistogram structure out has already been
     allocated and initialized.
- 
-    GUS: verify that image/mask have the
- correct types
- sizes
+    GUS: verify that image/mask have the, correct types and  sizes.
  *****************************************************************************/
 psHistogram *psImageHistogram(psHistogram *out,
@@ -88,4 +91,10 @@
     int i = 0;
     int j = 0;
+
+    // GUS: Verify this action.
+    if ((out == NULL) ||
+            (in == NULL)) {
+        return(NULL);
+    }
 
     junkData = psVectorAlloc(in->numRows * in->numCols, in->type.type);
