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);