Fix #2270
Check userinfo first before trying to use it.
This commit is contained in:
woogerboy21 2016-11-09 08:40:18 -05:00 committed by ctrlaltca
parent 6962777ded
commit f6e4ee9a4a

View file

@ -387,7 +387,7 @@ void Server_ProtocolHandler::pingClockTimeout()
if (timeRunning - lastDataReceived > server->getMaxPlayerInactivityTime()) if (timeRunning - lastDataReceived > server->getMaxPlayerInactivityTime())
prepareDestroy(); prepareDestroy();
if (QString::fromStdString(userInfo->privlevel()).toLower() == "none") { if (!userInfo || QString::fromStdString(userInfo->privlevel()).toLower() == "none") {
if ((server->getIdleClientTimeout() > 0) && (idleClientWarningSent)) { if ((server->getIdleClientTimeout() > 0) && (idleClientWarningSent)) {
if (timeRunning - lastActionReceived > server->getIdleClientTimeout()) { if (timeRunning - lastActionReceived > server->getIdleClientTimeout()) {
prepareDestroy(); prepareDestroy();
@ -472,7 +472,7 @@ Response::ResponseCode Server_ProtocolHandler::cmdLogin(const Command_Login &cmd
} }
// limit the number of non-privileged users that can connect to the server based on configuration settings // limit the number of non-privileged users that can connect to the server based on configuration settings
if (QString::fromStdString(userInfo->privlevel()).toLower() == "none") { if (!userInfo || QString::fromStdString(userInfo->privlevel()).toLower() == "none") {
if (server->getMaxUserLimitEnabled()) { if (server->getMaxUserLimitEnabled()) {
if (server->getUsersCount() > server->getMaxUserTotal()) { if (server->getUsersCount() > server->getMaxUserTotal()) {
qDebug() << "Max Users Total Limit Reached, please increase the max_users_total setting."; qDebug() << "Max Users Total Limit Reached, please increase the max_users_total setting.";