Fixed possible crash in RsGRouterSerialiser by checking return value of dynamic_cast.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8590 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2015-07-12 00:51:03 +00:00
parent eca970bb0c
commit 65bdc96b88

View File

@ -293,11 +293,21 @@ public:
virtual uint32_t size (RsItem *item)
{
return dynamic_cast<RsGRouterItem *>(item)->serial_size() ;
RsGRouterItem *gitem = dynamic_cast<RsGRouterItem *>(item);
if (!gitem)
{
return 0;
}
return gitem->serial_size() ;
}
virtual bool serialise(RsItem *item, void *data, uint32_t *size)
{
return dynamic_cast<RsGRouterItem *>(item)->serialise(data,*size) ;
RsGRouterItem *gitem = dynamic_cast<RsGRouterItem *>(item);
if (!gitem)
{
return false;
}
return gitem->serialise(data,*size) ;
}
virtual RsItem *deserialise (void *data, uint32_t *size) ;