aboutsummaryrefslogtreecommitdiff
path: root/src/database
diff options
context:
space:
mode:
authorSmallJoker <mk939@ymail.com>2021-01-29 18:02:40 +0100
committerSmallJoker <mk939@ymail.com>2021-01-29 18:02:40 +0100
commit9a177f009b4ed8d4e9f88d36e65d8b06b2c390e6 (patch)
treeb4a422b86e0d6084ff534fa63b08034d9cd2f298 /src/database
parent9c91cbf50c06f615449cb9ec1a5d0fbe9bc0bfa5 (diff)
downloadminetest-9a177f009b4ed8d4e9f88d36e65d8b06b2c390e6.tar.gz
minetest-9a177f009b4ed8d4e9f88d36e65d8b06b2c390e6.tar.bz2
minetest-9a177f009b4ed8d4e9f88d36e65d8b06b2c390e6.zip
PlayerDatabaseFiles: Fix segfault while saving a player
Corrects a typo introduced in 5e9dd166
Diffstat (limited to 'src/database')
-rw-r--r--src/database/database-files.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/database/database-files.cpp b/src/database/database-files.cpp
index d9e8f24ea..d9d113b4e 100644
--- a/src/database/database-files.cpp
+++ b/src/database/database-files.cpp
@@ -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());
@@ -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;
}