From 44e97b9ef667dc996d62907d13f5a8bce61bd627 Mon Sep 17 00:00:00 2001 From: Roman Artiukhin Date: Wed, 5 Feb 2025 19:46:39 +0200 Subject: [PATCH] plugins: imageviewer: Don't reload the image on the prev/next action if it's a single image. Fixes image reloading when only a single image file is present among other files. Change-Id: I6400af556d866ac96a3532712563bf01cbd29f68 --- apps/plugins/imageviewer/imageviewer.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/apps/plugins/imageviewer/imageviewer.c b/apps/plugins/imageviewer/imageviewer.c index cddc35c5fc..2aea93da91 100644 --- a/apps/plugins/imageviewer/imageviewer.c +++ b/apps/plugins/imageviewer/imageviewer.c @@ -633,7 +633,11 @@ static int scroll_bmp(struct image_info *info, bool initial_frame) case IMGVIEW_LEFT: if (entries > 1 && info->width <= LCD_WIDTH && info->height <= LCD_HEIGHT) - return change_filename(DIR_PREV); + { + int result = change_filename(DIR_PREV); + if (entries > 1) + return result; + } /* fallthrough */ case IMGVIEW_LEFT | BUTTON_REPEAT: pan_view_left(info); @@ -642,7 +646,11 @@ static int scroll_bmp(struct image_info *info, bool initial_frame) case IMGVIEW_RIGHT: if (entries > 1 && info->width <= LCD_WIDTH && info->height <= LCD_HEIGHT) - return change_filename(DIR_NEXT); + { + int result = change_filename(DIR_NEXT); + if (entries > 1) + return result; + } /* fallthrough */ case IMGVIEW_RIGHT | BUTTON_REPEAT: pan_view_right(info);