Self hosted FLOSS fitness/workout, nutrition and weight tracker
Catch exception if the ingredient doesn't exist
Roland Geiderf9e588936c62
diff --git a/wger/nutrition/sync.py b/wger/nutrition/sync.pyindex cd8cc255b..db1810143 100644--- a/wger/nutrition/sync.py+++ b/wger/nutrition/sync.py@@ -50,7 +50,6 @@ from wger.utils.requests import ()from wger.utils.url import make_uri-logger = logging.getLogger(__name__)@@ -58,7 +57,11 @@ def fetch_ingredient_image(pk: int):# wgerfrom wger.nutrition.models import Ingredient- ingredient = Ingredient.objects.get(pk=pk)+ try:+ ingredient = Ingredient.objects.get(pk=pk)+ except Ingredient.DoesNotExist:+ logger.info(f'Ingredient with ID {pk} does not exist')+ returnif hasattr(ingredient, 'image'):return