From dc83df8d974979ff4d1e5fc43f1f2be3d866bc29 Mon Sep 17 00:00:00 2001 From: David Klaftenegger Date: Mon, 4 Apr 2016 23:35:43 +0200 Subject: [PATCH] Prevent failure when target file is missing --- acertmgr.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/acertmgr.py b/acertmgr.py index 1c93761..a23c867 100755 --- a/acertmgr.py +++ b/acertmgr.py @@ -37,6 +37,8 @@ class InvalidCertificateError(Exception): # @param crt_file string containing the path to the certificate file # @return True if target file is at least as new as the certificate, False otherwise def target_isCurrent(target, crt_file): + if not os.path.isfile(target): + return False target_date = os.path.getmtime(target) crt_date = os.path.getmtime(crt_file) return target_date >= crt_date