changeset 642:c1306f6d6a79 jquery

fix in getParamRGBM/A to deal with empty input
author robcast
date Wed, 19 Jan 2011 19:45:53 +0100
parents 8f40f7b6fd20
children c108607e1bc0
files servlet/src/digilib/image/ImageJobDescription.java
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/servlet/src/digilib/image/ImageJobDescription.java	Wed Jan 19 15:53:08 2011 +0100
+++ b/servlet/src/digilib/image/ImageJobDescription.java	Wed Jan 19 19:45:53 2011 +0100
@@ -429,7 +429,10 @@
 		float[] paramRGBM = null;//{0f,0f,0f};
 		Parameter p = params.get("rgbm");
 		if (p.hasValue() && (!p.getAsString().equals("0/0/0"))) {
-			return p.parseAsFloatArray("/");
+			paramRGBM = p.parseAsFloatArray("/");
+			if ((paramRGBM == null) || (paramRGBM.length != 3)) {
+			    return null;
+			}
 		}	
 		return paramRGBM;
 	}
@@ -439,6 +442,9 @@
 		Parameter p = params.get("rgba");
 		if (p.hasValue() && (!p.getAsString().equals("0/0/0"))) {
 			paramRGBA = p.parseAsFloatArray("/");
+            if ((paramRGBA == null) || (paramRGBA.length != 3)) {
+                return null;
+            }
 		}
 		return paramRGBA;
 	}