mirror of
https://github.com/minetest/minetest.git
synced 2024-11-27 01:53:45 +01:00
PlayerDatabaseFiles: Fix segfault while saving a player
Corrects a typo introduced in 5e9dd166
This commit is contained in:
parent
9c91cbf50c
commit
9a177f009b
@ -121,9 +121,9 @@ void PlayerDatabaseFiles::serialize(RemotePlayer *p, std::ostream &os)
|
|||||||
args.setS32("version", 1);
|
args.setS32("version", 1);
|
||||||
args.set("name", p->m_name);
|
args.set("name", p->m_name);
|
||||||
|
|
||||||
// This should not happen
|
|
||||||
PlayerSAO *sao = p->getPlayerSAO();
|
PlayerSAO *sao = p->getPlayerSAO();
|
||||||
assert(sao);
|
// This should not happen
|
||||||
|
sanity_check(sao);
|
||||||
args.setU16("hp", sao->getHP());
|
args.setU16("hp", sao->getHP());
|
||||||
args.setV3F("position", sao->getBasePosition());
|
args.setV3F("position", sao->getBasePosition());
|
||||||
args.setFloat("pitch", sao->getLookPitch());
|
args.setFloat("pitch", sao->getLookPitch());
|
||||||
@ -189,7 +189,7 @@ void PlayerDatabaseFiles::savePlayer(RemotePlayer *player)
|
|||||||
|
|
||||||
// Open and serialize file
|
// Open and serialize file
|
||||||
std::ostringstream ss(std::ios_base::binary);
|
std::ostringstream ss(std::ios_base::binary);
|
||||||
serialize(&testplayer, ss);
|
serialize(player, ss);
|
||||||
if (!fs::safeWriteToFile(path, ss.str())) {
|
if (!fs::safeWriteToFile(path, ss.str())) {
|
||||||
infostream << "Failed to write " << path << std::endl;
|
infostream << "Failed to write " << path << std::endl;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user