mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-11-04 22:40:05 +00:00
Fix seg fault in buddy data for deleted player
This commit is contained in:
parent
121c65d7ea
commit
34f2aef248
@ -65,6 +65,8 @@ void BuddyManager::refreshBuddyList(CNSocket* sock) {
|
||||
if (buddyID != 0) {
|
||||
sBuddyBaseInfo buddyInfo = {};
|
||||
Database::DbPlayer buddyPlayerData = Database::getDbPlayerById(buddyID);
|
||||
if (buddyPlayerData.PlayerID == -1)
|
||||
continue;
|
||||
buddyInfo.bBlocked = 0;
|
||||
buddyInfo.bFreeChat = 1;
|
||||
buddyInfo.iGender = buddyPlayerData.Gender;
|
||||
|
@ -500,7 +500,10 @@ Player Database::DbToPlayer(DbPlayer player) {
|
||||
}
|
||||
|
||||
Database::DbPlayer Database::getDbPlayerById(int id) {
|
||||
return db.get_all<DbPlayer>(where(c(&DbPlayer::PlayerID) == id)).front();
|
||||
auto player = db.get_all<DbPlayer>(where(c(&DbPlayer::PlayerID) == id));
|
||||
if (player.size() < 1)
|
||||
return DbPlayer{ -1 };
|
||||
return player.front();
|
||||
}
|
||||
|
||||
Player Database::getPlayer(int id) {
|
||||
|
Loading…
Reference in New Issue
Block a user