void VehiclePlacement::place(const TrackOffsetIter &p, Anchor a)
{
+ if(!p)
+ return unplace();
+
float anchor = get_anchor_position(a);
for(vector<Axle>::iterator i=axles.begin(); i!=axles.end(); ++i)
float span = distance(p1, p2);
float adjust = target-span;
- /* If the adjustment is larger than the last one, we've hit a gap or
+ /* If the adjustment is not smaller than the last one, we've hit a gap or
other oddity in the track. Terminate to avoid an infinite loop. */
- if(last>0 && abs(adjust)>last)
+ if(last>0 && abs(adjust)>=last)
return 0;
if(abs(adjust)*10000<target)