hmm. I would really like to see the function that calls this one, so I can see where you are expecting the "you" to be set. Some functions like c_trace will set "you" (to the hit entity), but in your case it seems to not have one.
Maybe put a testVar = you.pan; in right before firing, in the parent function and see if it causes an error there too - if so, the problem is higher than you were previously looking.
Hope that helps, feel free to post the parent function if not. (and send me a PM so I don't miss it)
Don
have a great day