diff --git a/src/humulus/filters.py b/src/humulus/filters.py index 5c12f81..cf178d4 100644 --- a/src/humulus/filters.py +++ b/src/humulus/filters.py @@ -83,6 +83,8 @@ def recipe_ibu_ratio(recipe): """Return a recipe's IBU ratio""" if 'fermentables' not in recipe or 'hops' not in recipe: return '0' + if len(recipe['fermentables']) == 0: + return '0' # Otherwise a divide by zero error will occur og = float(recipe_og(recipe)) ibu = float(recipe_ibu(recipe)) return '{:.2f}'.format(round(0.001 * ibu / (og - 1), 2))