diff options
author | Yolanda Robla <info@ysoft.biz> | 2014-08-25 11:59:27 +0200 |
---|---|---|
committer | Yolanda Robla <yolanda.robla-mota@hp.com> | 2014-08-27 11:54:48 +0200 |
commit | 16698876d8b5456623c39e3e7280cd57aeb0a54e (patch) | |
tree | 7867cbaaa4fc9302cfd0b4cb7cd7642ec3aa77f4 | |
parent | 1d1df74c480d525011f352f76010becb315eeca5 (diff) | |
download | zuul-16698876d8b5456623c39e3e7280cd57aeb0a54e.tar.gz |
Add check for ref being a string before applying regex
Incorrect filter by ref in zuul layout could end on
applying a regex to a None value, causing an error and
zuul crashing. That is not an usual thing but could happen
and zuul crashes because of that.
Add the comparison for ref not being None
before applying the regex, as it was done for comment
comparison.
Change-Id: Ie58bb288a1f7609564283a0062e08ecc45b28cd0
-rw-r--r-- | zuul/model.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/zuul/model.py b/zuul/model.py index 1a99650a4..b03bbb0b6 100644 --- a/zuul/model.py +++ b/zuul/model.py @@ -1121,9 +1121,10 @@ class EventFilter(BaseFilter): # refs are ORed matches_ref = False - for ref in self.refs: - if ref.match(event.ref): - matches_ref = True + if event.ref is not None: + for ref in self.refs: + if ref.match(event.ref): + matches_ref = True if self.refs and not matches_ref: return False |