[eog] EogWindow: Avoid warning if collection is updated while reloading



commit a1d0b4f96952ccc1577b4d7c7398d83823c750f7
Author: Felix Riemann <friemann gnome org>
Date:   Thu Nov 5 20:53:19 2020 +0100

    EogWindow: Avoid warning if collection is updated while reloading
    
    The function to update the image position in the statusbar needs to
    take into account that the window may not have an image loaded although
    there are images in the collection. This can occur if the current image
    is reloaded. Updating the position text would have spawned a critical
    warning from eog_list_store_get_pos_by_image().

 src/eog-window.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/src/eog-window.c b/src/eog-window.c
index 131d0b37..28242c1f 100644
--- a/src/eog-window.c
+++ b/src/eog-window.c
@@ -488,7 +488,8 @@ update_image_pos (EogWindow *window)
 
        n_images = eog_list_store_length (EOG_LIST_STORE (priv->store));
 
-       if (n_images > 0) {
+       /* priv->image may be NULL even if n_images > 0 */
+       if (n_images > 0 && priv->image) {
                pos = eog_list_store_get_pos_by_image (EOG_LIST_STORE (priv->store),
                                                       priv->image);
        }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]