Car test Ray problem in BGE I did a little "realistic" buggy test, please watch my video (I'm french but I did the video in English). 

I just have a little issue, see the python console and my explanation in the video or in the picture below.

The problem is when my ray sensor no longer detects the ground (When car is in mid-air.) It generates an error in the python console and decreases the framerate of my game (especially in full screen). I don't know how to fix this in my script.
This error occurs when my ray detects nothing in its range.

Here's a picture:



Here's the video: https://www.youtube.com/watch?v=fAOVMnYo-ao
You already know what is causing the problem, it is because your script is trying to loop through a empty list (when the ray sensor is not hitting anything.)

All you have to do to fix it is add one line to your script.

if sol:
    #then your if statements goes in here


or change your if statement to this:

if sol and 'Sable' in sol and own['Vitesse'] &gt; 10:


That one line checks to see if your ray is hitting anything, if it is then the rest of your logic will run. If the ray hits nothing, then there is no error because nothing happens.