mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
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:
parent
eca970bb0c
commit
65bdc96b88
@ -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) ;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user