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
This commit is contained in:
Yolanda Robla 2014-08-25 11:59:27 +02:00 committed by Yolanda Robla
parent 1d1df74c48
commit 16698876d8

View File

@ -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