From 6f5fbeaf59e851c27f3715fe1b1f91c2a6271274 Mon Sep 17 00:00:00 2001 From: Ruslan Lutsenko Date: Thu, 8 Mar 2012 10:44:57 +0100 Subject: [PATCH] FIX: TypeError: 'NoneType' object is unsubscriptable when _data[buildtype] == None --- jenkinsapi/job.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/jenkinsapi/job.py b/jenkinsapi/job.py index dfb6faf..bb98143 100644 --- a/jenkinsapi/job.py +++ b/jenkinsapi/job.py @@ -102,6 +102,8 @@ class Job(JenkinsBase): """Gets a buildid for a given type of build""" KNOWNBUILDTYPES=["lastSuccessfulBuild", "lastBuild", "lastCompletedBuild"] assert buildtype in KNOWNBUILDTYPES + if self._data[buildtype] == None: + return None buildid = self._data[buildtype]["number"] assert type(buildid) == int, "Build ID should be an integer, got %s" % repr( buildid ) return buildid -- 2.34.1