diff --git a/klipper/klipper.cpp b/klipper/klipper.cpp --- a/klipper/klipper.cpp +++ b/klipper/klipper.cpp @@ -930,16 +930,26 @@ QWidget* mw = new QWidget(dlg); QHBoxLayout* layout = new QHBoxLayout(mw); - AbstractBarcode *qrCode = createBarcode(QRCode); - AbstractBarcode *dataMatrix = createBarcode(DataMatrix); - if (item) { - qrCode->setData(item->text()); - dataMatrix->setData(item->text()); + { + AbstractBarcode *qrCode = createBarcode(QRCode); + if (qrCode) { + if(item) { + qrCode->setData(item->text()); + } + BarcodeLabel *qrCodeLabel = new BarcodeLabel(qrCode, mw); + layout->addWidget(qrCodeLabel); + } + } + { + AbstractBarcode *dataMatrix = createBarcode(DataMatrix); + if (dataMatrix) { + if (item) { + dataMatrix->setData(item->text()); + } + BarcodeLabel *dataMatrixLabel = new BarcodeLabel(dataMatrix, mw); + layout->addWidget(dataMatrixLabel); + } } - BarcodeLabel *qrCodeLabel = new BarcodeLabel(qrCode, mw); - BarcodeLabel *dataMatrixLabel = new BarcodeLabel(dataMatrix, mw); - layout->addWidget(qrCodeLabel); - layout->addWidget(dataMatrixLabel); mw->setFocus(); QVBoxLayout *vBox = new QVBoxLayout(dlg);