]> www.fi.muni.cz Git - evince.git/commitdiff
libview: Make sure we have a valid page range before getting/setting selection list
authorCarlos Garcia Campos <carlosgc@gnome.org>
Sun, 21 Nov 2010 11:27:21 +0000 (12:27 +0100)
committerCarlos Garcia Campos <carlosgc@gnome.org>
Sun, 21 Nov 2010 11:27:21 +0000 (12:27 +0100)
Fixes bug #630999.

libview/ev-pixbuf-cache.c

index 367f70d781fd52490186d3a09b354ee8a26e4c81..ee68354575168a54437cece64cab3de726573f20 100644 (file)
@@ -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++) {