[fix] handling None return values e.g. for languages with no configs yet

This commit is contained in:
Al
2016-05-20 04:04:46 -04:00
parent 0c3dd33990
commit 985ba85623
6 changed files with 15 additions and 1 deletions

View File

@@ -38,6 +38,8 @@ class Floor(NumberedComponent):
@classmethod
def random(cls, language, country=None, num_floors=None, num_basements=None):
num_type, num_type_props = cls.choose_alphanumeric_type('levels.alphanumeric', language, country=country)
if num_type is None:
return None
if num_floors is not None:
number = cls.sample_floors(num_floors, num_basements or 0)