kill crash removing a task when none have been added

This commit is contained in:
Redmond Urbino 2008-03-13 01:42:40 +00:00
parent 7d9121d2d4
commit 88198adab6
1 changed files with 5 additions and 4 deletions

View File

@ -64,10 +64,11 @@ class DirectObject:
def removeTask(self, taskOrName):
if type(taskOrName) == type(''):
# we must use a copy, since task.remove will modify self._taskList
taskListValues = self._taskList.values()
for task in taskListValues:
if task.name == taskOrName:
task.remove()
if hasattr(self, '_taskList'):
taskListValues = self._taskList.values()
for task in taskListValues:
if task.name == taskOrName:
task.remove()
else:
taskOrName.remove()