Check if session is set before using it.