From 6c724329924d5a231e584c315d9ea7af6a574245 Mon Sep 17 00:00:00 2001 From: Lion Kortlepel Date: Thu, 29 Jul 2021 12:58:26 +0200 Subject: [PATCH] possible fix #37 --- src/TServer.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/TServer.cpp b/src/TServer.cpp index 4e90b2d..ed8d974 100644 --- a/src/TServer.cpp +++ b/src/TServer.cpp @@ -312,7 +312,12 @@ void TServer::ParseVehicle(TClient& c, const std::string& Pckt, TNetwork& Networ } void TServer::Apply(TClient& c, int VID, const std::string& pckt) { - std::string Packet = pckt.substr(pckt.find('{')), VD = c.GetCarData(VID); + std::string Packet = pckt.substr(pckt.find('{')); + std::string VD = c.GetCarData(VID); + if (VD.empty()) { + error("Tried to apply change to vehicle that does not exist"); + return; + } std::string Header = VD.substr(0, VD.find('{')); VD = VD.substr(VD.find('{'));