[shotwell] Clamp scale size instead of asserting



commit 2cd32d6e6faa9b9e02d61a41c63a51547c65ecb0
Author: Jens Georg <mail jensge org>
Date:   Thu Sep 15 20:15:21 2022 +0200

    Clamp scale size instead of asserting

 src/MediaPage.vala | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
---
diff --git a/src/MediaPage.vala b/src/MediaPage.vala
index 51f73d79..5fa3fcaa 100644
--- a/src/MediaPage.vala
+++ b/src/MediaPage.vala
@@ -90,10 +90,7 @@ public abstract class MediaPage : CheckerboardPage {
         }
         
         public static double scale_to_slider(int value) {
-            assert(value >= Thumbnail.MIN_SCALE);
-            assert(value <= Thumbnail.MAX_SCALE);
-            
-            return (double) ((value - Thumbnail.MIN_SCALE) / SLIDER_STEPPING);
+            return (double) ((value.clamp(Thumbnail.MIN_SCALE, Thumbnail.MAX_SCALE) - Thumbnail.MIN_SCALE) / 
SLIDER_STEPPING);
         }
 
         public static int slider_to_scale(double value) {


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