From 4bfe6d1ac9f584b07b4700247a83aab89e8dfae9 Mon Sep 17 00:00:00 2001 From: Son NK <> Date: Fri, 15 Jan 2021 11:21:45 +0100 Subject: [PATCH] handle name can be None in get_name_initial() --- app/models.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/models.py b/app/models.py index 45e07cae..606bb535 100644 --- a/app/models.py +++ b/app/models.py @@ -524,6 +524,8 @@ class User(db.Model, ModelMixin, UserMixin): return self.name, [other_name, "Anonymous", "whoami"] def get_name_initial(self) -> str: + if not self.name: + return "" names = self.name.split(" ") return "".join([n[0].upper() for n in names if n])