From 4cab5dc743487673b544b44ff9a985da3413aa25 Mon Sep 17 00:00:00 2001 From: thunder2 Date: Thu, 29 Jan 2015 16:09:32 +0000 Subject: [PATCH] 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 --- .../src/gui/Identity/IdEditDialog.cpp | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/retroshare-gui/src/gui/Identity/IdEditDialog.cpp b/retroshare-gui/src/gui/Identity/IdEditDialog.cpp index df3c86aaa..bc64d4071 100644 --- a/retroshare-gui/src/gui/Identity/IdEditDialog.cpp +++ b/retroshare-gui/src/gui/Identity/IdEditDialog.cpp @@ -508,20 +508,20 @@ void IdEditDialog::updateId() mEditGroup.mMeta.mGroupName = groupname; - 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 - mEditGroup.mImage.copy((uint8_t *) ba.data(), ba.size()); - } - else - mEditGroup.mImage.clear(); + mEditGroup.mImage.copy((uint8_t *) ba.data(), ba.size()); + } + else + mEditGroup.mImage.clear(); uint32_t dummyToken = 0; rsIdentity->updateIdentity(dummyToken, mEditGroup); @@ -551,4 +551,4 @@ void IdEditDialog::removeAvatar() uint32_t dummyToken = 0; rsIdentity->updateIdentity(dummyToken, mEditGroup); -} \ No newline at end of file +}