# HG changeset patch # User Andre Heinecke # Date 1395837167 -3600 # Node ID 825b42da1855cd628c5cc233a439203067d569c5 # Parent 60c5df8e79809d798bc2aa547d1b3bbfc3bd3e4e Avoid printing an error when an empty certificate ist constructed diff -r 60c5df8e7980 -r 825b42da1855 ui/certificate.cpp --- a/ui/certificate.cpp Wed Mar 26 13:29:09 2014 +0100 +++ b/ui/certificate.cpp Wed Mar 26 13:32:47 2014 +0100 @@ -15,6 +15,10 @@ x509_crt x509cert; + if (b64Line.isEmpty()) { + return; + } + /* Cut of the first two chars (e.g. I: and decode) */ QByteArray asn1data = QByteArray::fromBase64( b64Line.right(b64Line.size() - 2).toLatin1()); @@ -25,6 +29,7 @@ asn1data.size()); if (ret != 0) { qDebug() << "Parsing certificate failed with error: " << ret; + qDebug() << "Failed cert: " << asn1data.toBase64(); x509_crt_free(&x509cert); return; } diff -r 60c5df8e7980 -r 825b42da1855 ui/tests/certlistparsertest.cpp --- a/ui/tests/certlistparsertest.cpp Wed Mar 26 13:29:09 2014 +0100 +++ b/ui/tests/certlistparsertest.cpp Wed Mar 26 13:32:47 2014 +0100 @@ -51,6 +51,7 @@ QVERIFY(instLines.size() == instList.size()); QVERIFY(remoLines.size() == remoList.size()); + /* Check that a default certificate is invalid */ Certificate cert; QVERIFY(!cert.isValid()); @@ -96,7 +97,6 @@ { const char *fname = "empty_file"; CertificateList *certList = testWithFile(fname); - printf("Status :%i\n ",certList->getStatus()); QCOMPARE (certList->getStatus(), SeekFailed); delete certList; }