summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorinfirit <[email protected]>2014-12-09 15:11:31 +0100
committerinfirit <[email protected]>2014-12-09 23:02:28 +0100
commitba7af404335a71a45dc0f39b20e496f32f7eb81d (patch)
tree3e9178854a655f255809ca027b476062bf8bb6a9
parent559014c4a9ee740055c9cf838347acdaf69ed570 (diff)
downloadatril-ba7af404335a71a45dc0f39b20e496f32f7eb81d.tar.bz2
atril-ba7af404335a71a45dc0f39b20e496f32f7eb81d.tar.xz
libview: Make sure we have a valid page range before getting/setting selection list
Taken from evince commit: a3b87cb28e46958b37e384a47604032ea0889807 From: Carlos Garcia Campos <[email protected]> Gnome bug: https://bugzilla.gnome.org/show_bug.cgi?id=630999
-rw-r--r--libview/ev-pixbuf-cache.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libview/ev-pixbuf-cache.c b/libview/ev-pixbuf-cache.c
index 9741e434..118d3f33 100644
--- a/libview/ev-pixbuf-cache.c
+++ b/libview/ev-pixbuf-cache.c
@@ -1035,6 +1035,9 @@ ev_pixbuf_cache_set_selection_list (EvPixbufCache *pixbuf_cache,
if (!EV_IS_SELECTION (pixbuf_cache->document))
return;
+ if (pixbuf_cache->start_page == -1 || pixbuf_cache->end_page == -1)
+ return;
+
/* We check each area to see what needs updating, and what needs freeing; */
page = pixbuf_cache->start_page - pixbuf_cache->preload_cache_size;
for (i = 0; i < pixbuf_cache->preload_cache_size; i++) {
@@ -1114,6 +1117,9 @@ ev_pixbuf_cache_get_selection_list (EvPixbufCache *pixbuf_cache)
g_return_val_if_fail (EV_IS_PIXBUF_CACHE (pixbuf_cache), NULL);
+ if (pixbuf_cache->start_page == -1 || pixbuf_cache->end_page == -1)
+ return NULL;
+
/* We check each area to see what needs updating, and what needs freeing; */
page = pixbuf_cache->start_page - pixbuf_cache->preload_cache_size;
for (i = 0; i < pixbuf_cache->preload_cache_size; i++) {