[libshumate] viewport: Validate min and max zoom levels



commit 8f3093304df01d8fa021c1e1f4a81f3eb82b9a90
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Thu Mar 4 13:51:10 2021 -0300

    viewport: Validate min and max zoom levels
    
    They must not contradict each other, e.g. max zoom level smaller
    than the min zoom level.

 shumate/shumate-viewport.c | 2 ++
 1 file changed, 2 insertions(+)
---
diff --git a/shumate/shumate-viewport.c b/shumate/shumate-viewport.c
index b71da67..d23957c 100644
--- a/shumate/shumate-viewport.c
+++ b/shumate/shumate-viewport.c
@@ -339,6 +339,7 @@ shumate_viewport_set_max_zoom_level (ShumateViewport *self,
                                      guint            max_zoom_level)
 {
   g_return_if_fail (SHUMATE_IS_VIEWPORT (self));
+  g_return_if_fail (max_zoom_level >= self->min_zoom_level);
 
   if (self->max_zoom_level == max_zoom_level)
     return;
@@ -378,6 +379,7 @@ shumate_viewport_set_min_zoom_level (ShumateViewport *self,
                                      guint            min_zoom_level)
 {
   g_return_if_fail (SHUMATE_IS_VIEWPORT (self));
+  g_return_if_fail (min_zoom_level <= self->max_zoom_level);
 
   if (self->min_zoom_level == min_zoom_level)
     return;


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