From d5c2dfdc98f48d6f110740ec8b56ea67181f950d Mon Sep 17 00:00:00 2001
From: "Ian Y. Choi" <ianyrchoi@gmail.com>
Date: Tue, 13 Sep 2022 00:31:03 +0900
Subject: [PATCH] Skip if e-mail in Gerrit is None

Need to skip to work properly if E-mail address preferred in Gerrit
for owner's account is None

Change-Id: I2f222c9c58b9db9df1eb8370b1703ef690c1243d
---
 openstack_election/owners.py | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/openstack_election/owners.py b/openstack_election/owners.py
index 1ce36bce..3b85386f 100644
--- a/openstack_election/owners.py
+++ b/openstack_election/owners.py
@@ -368,6 +368,14 @@ def main(options):
                                             'commit']['committer']['email']
                                     break
 
+                            # If the E-mail address is not found, skip
+                            # since the item cannot be validated any more
+                            if email is None:
+                                print(
+                                    'ACCOUNT PREFERRED EMAIL IS NONE: %s'
+                                    % owner, file=sys.stderr)
+                                continue
+
                             # Find duplicate addresses and merge
                             # accounts when that happens
                             address = normalize_email(email)