X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fnet%2Fprotocol.h;h=256d978ec1d2ca0dfc24ce0bb29da4ac9f006445;hb=9a4e72786cb5026fe80a16337f5b916310c7a562;hp=05ea60e2f13232305a0ca18c9b50850db25e013c;hpb=8248f2912454229f4ded72b8fb4db3e76ea3ad15;p=libs%2Fnet.git diff --git a/source/net/protocol.h b/source/net/protocol.h index 05ea60e..256d978 100644 --- a/source/net/protocol.h +++ b/source/net/protocol.h @@ -294,6 +294,8 @@ template unsigned Protocol::serialize(const P &pkt, char *buf, unsigned size) const { const PacketTypeDef

&pdef = get_packet_by_class

(); + if(!pdef.get_id()) + throw std::invalid_argument("no packet id"); char *ptr = pdef.serialize(pkt, buf+4, buf+size); size = ptr-buf; header_def.serialize(PacketHeader(pdef.get_id(), size), buf, buf+4);