[recipes] Handle mixed units on the shopping list
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [recipes] Handle mixed units on the shopping list
- Date: Thu, 1 Mar 2018 07:27:28 +0000 (UTC)
commit b890fab4e792bb69ffe867639de52fd7557ac813
Author: Matthias Clasen <mclasen redhat com>
Date: Thu Mar 1 02:24:05 2018 -0500
Handle mixed units on the shopping list
This should not happen in real life, but I ran into this
situation in a demo, and it crashed the app.
src/gr-shopping-page.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
---
diff --git a/src/gr-shopping-page.c b/src/gr-shopping-page.c
index fb50832..0c06651 100644
--- a/src/gr-shopping-page.c
+++ b/src/gr-shopping-page.c
@@ -240,10 +240,15 @@ ingredient_format_unit (Ingredient *ing)
a1 += a;
}
else {
- g_error ("conversion yielded different units...why...");
+ if (s->len > 0)
+ g_string_append (s, ", ");
+ gr_convert_format (s, a, u);
+ g_warning ("conversion yielded different units (%s: %s vs %s)...why...",
ing->ingredient, gr_unit_get_name (u), gr_unit_get_name (u1));
}
}
+ if (s->len > 0)
+ g_string_append (s, ", ");
gr_convert_format (s, a1, u1);
return g_strdup (s->str);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]