mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-25 15:39:27 -05:00
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:
parent
e53f531271
commit
090148cea2
@ -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) ;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user