Send biography packet only if the biography is set

This commit is contained in:
Image 2021-03-10 07:52:50 -05:00
parent 0cb26e084d
commit 49bb456594

View file

@ -9233,7 +9233,20 @@ void Client::SendBiography() {
PacketStruct* packet = configReader.getStruct("WS_BioUpdate", GetVersion());
if (packet) {
char biography[512];
strncpy(biography, player->GetInfoStruct()->get_biography().c_str(), player->GetInfoStruct()->get_biography().size());
if(player->GetInfoStruct()->get_biography().size() < 1)
{
safe_delete(packet);
return;
}
else
{
int16 size = player->GetInfoStruct()->get_biography().size();
if(size>511)
size = 511;
strncpy(biography, player->GetInfoStruct()->get_biography().c_str(), player->GetInfoStruct()->get_biography().size());
biography[player->GetInfoStruct()->get_biography().size()] = '\0';
}
packet->setDataByName("biography", biography);
QueuePacket(packet->serialize());
@ -10278,4 +10291,4 @@ void Client::AwardCoins(int64 total_coins, std::string reason)
int8 type = CHANNEL_LOOT;
SimpleMessage(type, message.c_str());
}
}
}