fixed malloc problem when chat avatar is missing

This commit is contained in:
csoler 2017-06-03 10:30:02 +02:00
parent e726bd1061
commit 23156ab4b1

View File

@ -169,6 +169,12 @@ class p3ChatService::AvatarInfo
void toUnsignedChar(unsigned char *& data,uint32_t& size) const
{
if(_image_size == 0)
{
size = 0 ;
data = NULL ;
return ;
}
data = (unsigned char *)rs_malloc(_image_size) ;
size = _image_size ;
memcpy(data,_image_data,size*sizeof(unsigned char)) ;