mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-13 08:29:32 -05:00
Fixed possible crash in RsFileTransferSerialiser by checking return value of dynamic_cast.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8592 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
86a5c2e656
commit
63d85f8077
@ -229,11 +229,21 @@ class RsFileTransferSerialiser: public RsSerialType
|
||||
|
||||
virtual uint32_t size(RsItem *item)
|
||||
{
|
||||
return dynamic_cast<RsFileTransferItem*>(item)->serial_size() ;
|
||||
RsFileTransferItem *ftitem = dynamic_cast<RsFileTransferItem *>(item);
|
||||
if (!ftitem)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return ftitem->serial_size() ;
|
||||
}
|
||||
virtual bool serialise(RsItem *item, void *data, uint32_t *size)
|
||||
{
|
||||
return dynamic_cast<RsFileTransferItem*>(item)->serialise(data,*size) ;
|
||||
RsFileTransferItem *ftitem = dynamic_cast<RsFileTransferItem *>(item);
|
||||
if (!ftitem)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return ftitem->serialise(data,*size) ;
|
||||
}
|
||||
virtual RsFileTransferItem *deserialise(void *data, uint32_t *size);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user