Fix #4437: Crash in Network::Server_Handle_AUTH

This commit is contained in:
Michał Janiszewski authored and Ted John committed 2016-09-19 19:25:00 +01:00
1 parent b90f27a971
commit 6a86f007f3
1 file changed
+7 -1
+7 -1
View File
@@ -670,7 +670,13 @@ uint8 Network::GetGroupIDByHash(const std::string &keyhash)
uint8 groupId = GetDefaultGroup();
if (networkUser != nullptr && networkUser->GroupId.HasValue()) {
groupId = networkUser->GroupId.GetValue();
const uint8 assignedGroup = networkUser->GroupId.GetValue();
if (GetGroupByID(assignedGroup) != nullptr) {
groupId = assignedGroup;
} else {
log_warning("User %s is assigned to non-existent group %u. Assigning to default group (%u)",
keyhash.c_str(), assignedGroup, groupId);
}
}
return groupId;
}