[recipes] Don't crash without cuisines
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [recipes] Don't crash without cuisines
- Date: Sat, 27 May 2017 15:57:04 +0000 (UTC)
commit 5fdeb2cc941efd5214f7704842f43c17e5ebc11b
Author: Matthias Clasen <mclasen redhat com>
Date: Sat May 27 11:39:15 2017 -0400
Don't crash without cuisines
Not great to have no data, but crashing is not an option.
src/gr-cuisines-page.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/src/gr-cuisines-page.c b/src/gr-cuisines-page.c
index 2900452..82bd073 100644
--- a/src/gr-cuisines-page.c
+++ b/src/gr-cuisines-page.c
@@ -169,6 +169,12 @@ populate_cuisines (GrCuisinesPage *page)
g_clear_pointer (&page->featured, g_free);
length = g_strv_length (cuisines);
+
+ if (length == 0) {
+ g_warning ("No cuisines found");
+ return;
+ }
+
if (!page->featured && length > 0) {
int pos;
pos = g_random_int_range (0, length);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]