I was busy writing my CTF gamemode when this error came up. I tried fixing it, but could really not figure out what the actual source is.
Screenshot:

I really dont get how anything there should be null as I checked everything before.
Additionally this error only appears the first time I start the script after starting ManiaPlanet. And finally when I added (Player.Driver.Target is CSmPlayer) to the if condition ManiaPlanet just crashed.