Bug 0006

Rars crashes sometimes in Car::observe
 
Version 0.72
Solved in 0.73c
File carz.cpp
Owner Marc Gueury
Platform ALL (except Windows)
Impact on cars NONE
Impact on portability NONE

Description:

Rars crashes sometimes in carz.cpp in the line (XX).
Due to a bad line (->).

                  else  Behind_next = 0.0; // ...it is leader! :-)
               // distance to car behind:
                  if (laps < 1 ||  // not for the first lap or last car!
        ->            position[which] == car_count-out_count-1)
                     Ahead_next = 0.0;
                  else
                     Ahead_next =
        XX           SF_crossing[order[position[which]+1]][laps-1] -

I have remove out_count in this line, else it crashes in XX.

Solution

Changed the condition to:

position[which] == car_count-1