Index: trunk/stac/src/stacTransform.c
===================================================================
--- trunk/stac/src/stacTransform.c	(revision 3666)
+++ trunk/stac/src/stacTransform.c	(revision 3669)
@@ -166,7 +166,11 @@
 	psImage *image = images->data[n]; // The input image
 	psPlaneTransform *map = maps->data[n]; // The map
-	psImage *error = errors->data[n]; // The error image
 	psImage *outImage = (*outputs)->data[n]; // The output image
-	psImage *outError = (*outErrors)->data[n]; // The output error image
+	psImage *error = NULL; // The error image
+	psImage *outError = NULL; // The output error image
+	if (errors) {
+	    error = errors->data[n];
+	    outError = (*outErrors)->data[n];
+	}
 	float offset = 0.0;		// Relative offset
 	float scale = 1.0;		// Relative scale
@@ -177,14 +181,4 @@
 	    scale = scales->data.F32[n];
 	}
-
-#if 0
-	// No need for initialisation, since we iterate over the entire output image.
-	for (int y = 0; y < outny; y++) {
-	    for (int x = 0; x < outnx; x++) {
-		outImage->data.F32[y][x] = 0.0;
-		outError->data.F32[y][x] = 0.0;
-	    }
-	}
-#endif
 
 	// Mask
@@ -208,9 +202,11 @@
 									      detector->y, mask, 1, 0.0,
 									      PS_INTERPOLATE_BILINEAR);
-		    // Error is actually the variance
-		    outError->data.F32[y][x] = (psF32)p_psImageErrorInterpolateBILINEAR_F32(error,
-											    detector->x,
-											    detector->y,
-											    mask, 1, 0.0);
+		    if (error) {
+			// Error is actually the variance
+			outError->data.F32[y][x] = (psF32)p_psImageErrorInterpolateBILINEAR_F32(error,
+												detector->x,
+												detector->y,
+												mask, 1, 0.0);
+		    }
 
 		    outImage->data.F32[y][x] = (outImage->data.F32[y][x] - offset) / scale;
