From: Luke Dashjr Date: Sun, 15 Apr 2012 01:00:27 +0000 (-0400) Subject: Bugfix: Check that QRcode_encodeString didn't return NULL (error) X-Git-Tag: v0.4.0-unstable~129^2~75^2 X-Git-Url: https://git.novaco.in/?p=novacoin.git;a=commitdiff_plain;h=2eb665c63446570e5e5642fbefe21bdd43e02cb9 Bugfix: Check that QRcode_encodeString didn't return NULL (error) Without this, any error will segfault Bitcoin-Qt --- diff --git a/src/qt/qrcodedialog.cpp b/src/qt/qrcodedialog.cpp index 9965f14..2a428fb 100644 --- a/src/qt/qrcodedialog.cpp +++ b/src/qt/qrcodedialog.cpp @@ -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;