Fixed another crash in IdEditDialog::createId when avatar is not set.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7887 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2015-01-29 17:51:25 +00:00
parent 4cab5dc743
commit 7cfd50f860

View File

@ -470,22 +470,22 @@ void IdEditDialog::createId()
RsIdentityParameters params;
params.nickname = groupname;
params.isPgpLinked = (ui.radioButton_GpgId->isChecked());
params.isPgpLinked = (ui.radioButton_GpgId->isChecked());
const QPixmap *pixmap = ui.avatarLabel->pixmap();
const QPixmap *pixmap = ui.avatarLabel->pixmap();
if (!pixmap->isNull())
{
QByteArray ba;
QBuffer buffer(&ba);
if (pixmap && !pixmap->isNull())
{
QByteArray ba;
QBuffer buffer(&ba);
buffer.open(QIODevice::WriteOnly);
pixmap->save(&buffer, "PNG"); // writes image into ba in PNG format
buffer.open(QIODevice::WriteOnly);
pixmap->save(&buffer, "PNG"); // writes image into ba in PNG format
params.mImage.copy((uint8_t *) ba.data(), ba.size());
}
else
params.mImage.clear();
params.mImage.copy((uint8_t *) ba.data(), ba.size());
}
else
params.mImage.clear();
uint32_t dummyToken = 0;
rsIdentity->createIdentity(dummyToken, params);