[recipes/rational-approximation: 2/4] Don't create a fraction with 0 denominator



commit 4bf1716b0c4166c7cb3f3e0562d941022bb937cd
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Jun 24 17:32:38 2017 -0400

    Don't create a fraction with 0 denominator
    
    This tends to cause division by zero.

 src/gr-ingredients-list.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/src/gr-ingredients-list.c b/src/gr-ingredients-list.c
index 01706e3..592bd75 100644
--- a/src/gr-ingredients-list.c
+++ b/src/gr-ingredients-list.c
@@ -93,7 +93,7 @@ gr_ingredients_list_populate (GrIngredientsList  *ingredients,
                 segment = fields[3];
 
                 ing = g_new0 (Ingredient, 1);
-                gr_number_set_fraction (&ing->amount, 0, 0);
+                gr_number_set_fraction (&ing->amount, 0, 1);
                 if (amount[0] != '\0' &&
                     !gr_number_parse (&ing->amount, &amount, &local_error)) {
                         g_message ("failed to parse amount '%s': %s", amount, local_error->message);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]