The function _GetJobStatusForDependencies expects SafeLoadJobFromDisk
to return None and plans to raise a well-defined exception in that case.
However, if SafeLoadJobFromDisk actually does return None, the unguarded
assertion on job.writable causes an AttributeError first. So guard
this assertion.

Signed-off-by: Klaus Aehlig <[email protected]>
---
 lib/jqueue/__init__.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/jqueue/__init__.py b/lib/jqueue/__init__.py
index 6fcb3e5..df66d94 100644
--- a/lib/jqueue/__init__.py
+++ b/lib/jqueue/__init__.py
@@ -1901,7 +1901,8 @@ class JobQueue(object):
     # Try to load from disk
     job = self.SafeLoadJobFromDisk(job_id, True, writable=False)
 
-    assert not job.writable, "Got writable job" # pylint: disable=E1101
+    if job:
+      assert not job.writable, "Got writable job" # pylint: disable=E1101
 
     if job:
       return job.CalcStatus()
-- 
2.2.0.rc0.207.ga3a616c

Reply via email to