The following code returns a nil value in online sessions, running this code in a singleplayer session works as expected.
ac.getSession(ac.getSim().currentSessionIndex)
or
I can't seem to find any explanation for this issue in the documentation so I assume this is not working as expected.