Added null checks to fix crash on exit if game has been disposed.