diff --git a/src/TServer.cpp b/src/TServer.cpp index 56e6f74..5994540 100644 --- a/src/TServer.cpp +++ b/src/TServer.cpp @@ -25,6 +25,10 @@ struct VehiclePacket { static std::optional> GetPidVid(const std::string& str) { auto IDSep = str.find('-'); + if (IDSep == std::string::npos) { + beammp_debugf("Invalid packet: Could not parse pid/vid from packet, as there is no '-' separator: '{}'", str); + return std::nullopt; + } std::string pid = str.substr(0, IDSep); std::string vid = str.substr(IDSep + 1);