mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Inv deSerialize(): Prevent infinite loop, error on failure (#7711)
Throws an error about potentially damaged player inventories but proceeds converting the rest of them
This commit is contained in:
parent
81c06dea9b
commit
220ec79e4a
2 changed files with 31 additions and 17 deletions
|
@ -139,7 +139,12 @@ void RemotePlayer::deSerialize(std::istream &is, const std::string &playername,
|
|||
} catch (SettingNotFoundException &e) {}
|
||||
}
|
||||
|
||||
inventory.deSerialize(is);
|
||||
try {
|
||||
inventory.deSerialize(is);
|
||||
} catch (SerializationError &e) {
|
||||
errorstream << "Failed to deserialize player inventory. player_name="
|
||||
<< name << " " << e.what() << std::endl;
|
||||
}
|
||||
|
||||
if (!inventory.getList("craftpreview") && inventory.getList("craftresult")) {
|
||||
// Convert players without craftpreview
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue