Merge pull request #1100 from luke-jr/qrcode_errchk
Bugfix: Check that QRcode_encodeString didn't return NULL (error)
This commit is contained in:
commit
c99ddfaa22
1 changed files with 5 additions and 0 deletions
|
@ -41,6 +41,11 @@ void QRCodeDialog::genCode()
|
||||||
ui->lblQRCode->setText("");
|
ui->lblQRCode->setText("");
|
||||||
|
|
||||||
QRcode *code = QRcode_encodeString(uri.toUtf8().constData(), 0, QR_ECLEVEL_L, QR_MODE_8, 1);
|
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 = QImage(code->width + 8, code->width + 8, QImage::Format_RGB32);
|
||||||
myImage.fill(0xffffff);
|
myImage.fill(0xffffff);
|
||||||
unsigned char *p = code->data;
|
unsigned char *p = code->data;
|
||||||
|
|
Loading…
Reference in a new issue