lcsim/src/org/lcsim/util/swim
diff -u -r1.10 -r1.11
--- Line.java 15 Jul 2006 09:38:56 -0000 1.10
+++ Line.java 8 Jun 2007 21:29:53 -0000 1.11
@@ -10,7 +10,7 @@
/**
* A straight line
* @author tonyj
- * @version $Id: Line.java,v 1.10 2006/07/15 09:38:56 jstrube Exp $
+ * @version $Id: Line.java,v 1.11 2007/06/08 21:29:53 ngraf Exp $
*/
public class Line implements Trajectory
{
@@ -65,12 +65,15 @@
double[] distances = this.findInterceptsOnCylinder(r);
// Which is the best?
double bestDistance = -1.0;
- for (int i=0; i<distances.length; i++) {
- if (distances[i] >= 0.0) {
- // Potentially valid -- is it the best so far?
- if (bestDistance<0.0 || distances[i]<bestDistance) {
- // Yes!
- bestDistance = distances[i];
+ if (distances != null)
+ {
+ for (int i=0; i<distances.length; i++) {
+ if (distances[i] >= 0.0) {
+ // Potentially valid -- is it the best so far?
+ if (bestDistance<0.0 || distances[i]<bestDistance) {
+ // Yes!
+ bestDistance = distances[i];
+ }
}
}
}