[recipes] Avoid a crash
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [recipes] Avoid a crash
- Date: Sat, 18 Feb 2017 20:17:00 +0000 (UTC)
commit 0857b77cc8bd6b75661bc58792789c96d2f1b9b6
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Feb 18 10:20:24 2017 -0500
Avoid a crash
We shouldn't bring up the lightbox if we have no images to show.
src/gr-image-page.c | 6 ++++--
src/gr-window.c | 2 +-
2 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/src/gr-image-page.c b/src/gr-image-page.c
index 4fc3515..e6e56a4 100644
--- a/src/gr-image-page.c
+++ b/src/gr-image-page.c
@@ -332,6 +332,8 @@ void
gr_image_page_show_image (GrImagePage *page,
int idx)
{
- page->index = idx % page->images->len;
- set_current_image (page);
+ if (page->images->len > 0) {
+ page->index = idx % page->images->len;
+ set_current_image (page);
+ }
}
diff --git a/src/gr-window.c b/src/gr-window.c
index 05d3e94..9d5262a 100644
--- a/src/gr-window.c
+++ b/src/gr-window.c
@@ -965,7 +965,7 @@ gr_window_show_image (GrWindow *window,
GArray *images,
int index)
{
- if (images) {
+ if (images && images->len > 0) {
gr_image_page_set_images (GR_IMAGE_PAGE (window->image_page), images);
gr_image_page_show_image (GR_IMAGE_PAGE (window->image_page), index);
gtk_stack_set_visible_child_name (GTK_STACK (window->main_stack), "image");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]