From 322d8d198312b143808777d5f3206d2fdb76f2b9 Mon Sep 17 00:00:00 2001 From: Farhaan Bukhsh Date: Sep 28 2016 16:57:33 +0000 Subject: Fix NoneType error when pagure-ci form is inactively updated first time When pagure-ci form is updated for the first time and the active box is not checked it threw error, because the ci_hook was not generated that time. --- diff --git a/pagure/hooks/pagure_ci.py b/pagure/hooks/pagure_ci.py index 7a671a3..fd8d405 100644 --- a/pagure/hooks/pagure_ci.py +++ b/pagure/hooks/pagure_ci.py @@ -151,6 +151,7 @@ class PagureCi(BaseHook): should be installed ''' - for hook in project.ci_hook: - hook.pagure_ci_token = None - SESSION.commit() + if project.ci_hook is not None: + for hook in project.ci_hook: + hook.pagure_ci_token = None + SESSION.commit()