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

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8599 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2015-07-12 01:43:10 +00:00
parent e53f531271
commit 090148cea2

View File

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