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:
thunder2 2015-07-12 00:58:05 +00:00
parent 86a5c2e656
commit 63d85f8077

View File

@ -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);