Skip to content

Commit

Permalink
Bugfix: Check that QRcode_encodeString didn't return NULL (error)
Browse files Browse the repository at this point in the history
Without this, any error will segfault Bitcoin-Qt
  • Loading branch information
luke-jr committed Apr 15, 2012
1 parent 6f6f524 commit 2eb665c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/qt/qrcodedialog.cpp
Expand Up @@ -41,6 +41,11 @@ void QRCodeDialog::genCode()
ui->lblQRCode->setText("");

QRcode *code = QRcode_encodeString(uri.toUtf8().constData(), 0, QR_ECLEVEL_L, QR_MODE_8, 1);
if (!code)
{
ui->lblQRCode->setText(tr("Error encoding URI into QR Code."));
return;
}
myImage = QImage(code->width + 8, code->width + 8, QImage::Format_RGB32);
myImage.fill(0xffffff);
unsigned char *p = code->data;
Expand Down

0 comments on commit 2eb665c

Please sign in to comment.