fix: Check empty scan validity date when empty scan data is empty.

This commit is contained in:
sunwen
2024-06-12 16:57:19 +08:00
parent eb9a6037af
commit b873a1d1a7

View File

@@ -160,8 +160,7 @@ void MainWindow::checkEmptyScanValidity()
QDate lastScanDate = SQLHelper::queryValue("SELECT ScanDateTime FROM EScan ORDER BY ScanDateTime DESC LIMIT 1").toDate();
QDate expirationScanDate = lastScanDate.addMonths(1);
QDate currentDate = QDate::currentDate();
if(currentDate.daysTo(expirationScanDate) < 0)
if(lastScanDate.isNull() || currentDate.daysTo(expirationScanDate) < 0)
{
mTabWidget->setTabEnabled(0, false);
mTabWidget->setTabEnabled(1, false);