[LyX/master] Add test

Juergen Spitzmueller spitz at lyx.org
Tue Dec 20 04:08:01 UTC 2022


commit 226ce7505454fe0ddbdbaec50ac038e484da3572
Author: Juergen Spitzmueller <spitz at lyx.org>
Date:   Tue Dec 20 06:04:29 2022 +0100

    Add test
---
 src/LaTeXPackages.cpp |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/src/LaTeXPackages.cpp b/src/LaTeXPackages.cpp
index d2a22a8..bee3055 100644
--- a/src/LaTeXPackages.cpp
+++ b/src/LaTeXPackages.cpp
@@ -19,6 +19,7 @@
 #include "Lexer.h"
 
 #include "support/convert.h"
+#include "support/debug.h"
 #include "support/FileName.h"
 #include "support/filetools.h"
 #include "support/lstrings.h"
@@ -92,9 +93,15 @@ bool LaTeXPackages::isAvailableAtLeastFrom(string const & name,
 	// required date as int (yyyymmdd)
 	int const req_date = (y * 10000) + (m * 100) + d;
 	for (auto const & package : packages_) {
-		if (package.first == name && !package.second.empty())
+		if (package.first == name && !package.second.empty()) {
+			if (!isStrInt(package.second)) {
+				LYXERR0("Warning: Invalid date of package "
+					<< package.first << " (" << package.second << ")");
+				continue;
+			}
 			// required date not newer than available date
 			return req_date <= convert<int>(package.second);
+		}
 	}
 	return false;
 }


More information about the lyx-cvs mailing list