Skip to content

Commit

Permalink
Fix possible NoneType is not iterable error
Browse files Browse the repository at this point in the history
  • Loading branch information
buehlefs committed Jan 24, 2024
1 parent eb3e903 commit 2aad678
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion muse_for_music/models/helper_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,10 +225,14 @@ def _update_updateable_model_list(self, item_list: Sequence[dict],
if to_delete:
db.session.expire(self)

def update_list(self, item_list: Union[Sequence[int], Sequence[dict]],
def update_list(self, item_list: Union[Sequence[int], Sequence[dict], None],
old_items: Union[Dict[int, K], Dict[int, W]], mapping_cls: Any,
item_cls: Type[V] = None, mapping_cls_attribute: str = None):

# consider None an empty list
if item_list is None:
item_list = tuple()

if issubclass(mapping_cls, UpdateableModelMixin):
self._update_updateable_model_list(item_list, old_items, mapping_cls)
elif issubclass(item_cls, GetByID) and item_cls is not None and mapping_cls_attribute:
Expand Down

0 comments on commit 2aad678

Please sign in to comment.