Skip to content

Commit

Permalink
PlayerDatabaseFiles: Fix segfault while saving a player
Browse files Browse the repository at this point in the history
Corrects a typo introduced in 5e9dd16
  • Loading branch information
SmallJoker committed Jan 29, 2021
1 parent 9c91cbf commit 9a177f0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/database/database-files.cpp
Expand Up @@ -121,9 +121,9 @@ void PlayerDatabaseFiles::serialize(RemotePlayer *p, std::ostream &os)
args.setS32("version", 1);
args.set("name", p->m_name);

// This should not happen
PlayerSAO *sao = p->getPlayerSAO();
assert(sao);
// This should not happen
sanity_check(sao);
args.setU16("hp", sao->getHP());
args.setV3F("position", sao->getBasePosition());
args.setFloat("pitch", sao->getLookPitch());
Expand Down Expand Up @@ -189,7 +189,7 @@ void PlayerDatabaseFiles::savePlayer(RemotePlayer *player)

// Open and serialize file
std::ostringstream ss(std::ios_base::binary);
serialize(&testplayer, ss);
serialize(player, ss);
if (!fs::safeWriteToFile(path, ss.str())) {
infostream << "Failed to write " << path << std::endl;
}
Expand Down

0 comments on commit 9a177f0

Please sign in to comment.