Fixed crash in IdEditDialog::updateId when no avater is set.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7886 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2015-01-29 16:09:32 +00:00
parent b7f4e292f1
commit 4cab5dc743

View File

@ -508,20 +508,20 @@ void IdEditDialog::updateId()
mEditGroup.mMeta.mGroupName = groupname; mEditGroup.mMeta.mGroupName = groupname;
const QPixmap *pixmap = ui.avatarLabel->pixmap(); const QPixmap *pixmap = ui.avatarLabel->pixmap();
if (!pixmap->isNull()) if (pixmap && !pixmap->isNull())
{ {
QByteArray ba; QByteArray ba;
QBuffer buffer(&ba); QBuffer buffer(&ba);
buffer.open(QIODevice::WriteOnly); buffer.open(QIODevice::WriteOnly);
pixmap->save(&buffer, "PNG"); // writes image into ba in PNG format pixmap->save(&buffer, "PNG"); // writes image into ba in PNG format
mEditGroup.mImage.copy((uint8_t *) ba.data(), ba.size()); mEditGroup.mImage.copy((uint8_t *) ba.data(), ba.size());
} }
else else
mEditGroup.mImage.clear(); mEditGroup.mImage.clear();
uint32_t dummyToken = 0; uint32_t dummyToken = 0;
rsIdentity->updateIdentity(dummyToken, mEditGroup); rsIdentity->updateIdentity(dummyToken, mEditGroup);
@ -551,4 +551,4 @@ void IdEditDialog::removeAvatar()
uint32_t dummyToken = 0; uint32_t dummyToken = 0;
rsIdentity->updateIdentity(dummyToken, mEditGroup); rsIdentity->updateIdentity(dummyToken, mEditGroup);
} }