Index: trunk/psLib/src/math/psMinimizePolyFit.c
===================================================================
--- trunk/psLib/src/math/psMinimizePolyFit.c	(revision 37404)
+++ trunk/psLib/src/math/psMinimizePolyFit.c	(revision 37510)
@@ -731,4 +731,14 @@
 	  scale = false;
 	}
+
+	if (median == 0.0) {
+	  if (sigma <= 0.0) {
+	    scale = false; // Try with what we started with.
+	  }
+	  else {
+	    median = 0.1 * sigma;
+	  }
+	}
+
 	// I can't see a way to not clobber x if it's already F64, so make a copy.x
 	psVector *z64 = psVectorCopy(NULL,x64,PS_TYPE_F64);
@@ -740,5 +750,4 @@
 #endif
 
-	
 	result = VectorFitPolynomial1DOrd(poly, mask, maskValue, f64, fErr64, z64);
 	psFree(z64); // Done with this.
