From 7cfd50f8602b950467aa4222f46646039d60249b Mon Sep 17 00:00:00 2001 From: thunder2 Date: Thu, 29 Jan 2015 17:51:25 +0000 Subject: [PATCH] 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 --- .../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 bc64d4071..17081ac78 100644 --- a/retroshare-gui/src/gui/Identity/IdEditDialog.cpp +++ b/retroshare-gui/src/gui/Identity/IdEditDialog.cpp @@ -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);