X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fnet%2Fprotocol.h;h=256d978ec1d2ca0dfc24ce0bb29da4ac9f006445;hb=e6b880a3764447fff13b9fd0aff8e53a02add688;hp=05ea60e2f13232305a0ca18c9b50850db25e013c;hpb=b97d82a641331b097d6ae973d0a99a3818e9ccc2;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);