From 220ec79e4a10ea553310b16eb07d0c7a03fedb78 Mon Sep 17 00:00:00 2001 From: SmallJoker Date: Fri, 14 Sep 2018 20:29:21 +0200 Subject: Inv deSerialize(): Prevent infinite loop, error on failure (#7711) Throws an error about potentially damaged player inventories but proceeds converting the rest of them --- src/remoteplayer.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/remoteplayer.cpp') diff --git a/src/remoteplayer.cpp b/src/remoteplayer.cpp index e7c2462b6..3a72106de 100644 --- a/src/remoteplayer.cpp +++ b/src/remoteplayer.cpp @@ -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 -- cgit v1.2.3