diff --git a/allianceauth/__init__.py b/allianceauth/__init__.py index d76d5508..8109e93c 100644 --- a/allianceauth/__init__.py +++ b/allianceauth/__init__.py @@ -1,7 +1,7 @@ # This will make sure the app is always imported when # Django starts so that shared_task will use this app. -__version__ = '2.0.0' +__version__ = '2.0.1' NAME = 'Alliance Auth v%s' % __version__ default_app_config = 'allianceauth.apps.AllianceAuthConfig' diff --git a/allianceauth/authentication/signals.py b/allianceauth/authentication/signals.py index bd062b56..6f90cabc 100644 --- a/allianceauth/authentication/signals.py +++ b/allianceauth/authentication/signals.py @@ -103,12 +103,16 @@ def record_character_ownership(sender, instance, created, *args, **kwargs): @receiver(pre_delete, sender=CharacterOwnership) def validate_main_character(sender, instance, *args, **kwargs): - if instance.user.profile.main_character == instance.character: - logger.info("Ownership of a main character {0} has been revoked. Resetting {1} main character.".format( - instance.character, instance.user)) - # clear main character as user no longer owns them - instance.user.profile.main_character = None - instance.user.profile.save() + try: + if instance.user.profile.main_character == instance.character: + logger.info("Ownership of a main character {0} has been revoked. Resetting {1} main character.".format( + instance.character, instance.user)) + # clear main character as user no longer owns them + instance.user.profile.main_character = None + instance.user.profile.save() + except UserProfile.DoesNotExist: + # a user is being deleted + pass @receiver(post_delete, sender=Token)