fix server crash when session is empty.