diff --git a/vrobbler/apps/people/models.py b/vrobbler/apps/people/models.py index 969a2d3..872b709 100644 --- a/vrobbler/apps/people/models.py +++ b/vrobbler/apps/people/models.py @@ -33,8 +33,8 @@ class Person(TimeStampedModel): count = 0 for scrobble in Scrobble.objects.filter(user=self.created_by): if scrobble.log and isinstance(scrobble.log, dict): - person_ids = scrobble.log.get("with_people_ids", []) - if self.id in person_ids: + person_ids = scrobble.log.get("with_people_ids") or [] + if person_ids and self.id in person_ids: count += 1 self.scrobble_count = count self.save(update_fields=["scrobble_count"])