[gnome-builder] progress: be more graceful with invalid data



commit 8f0d2467c5fb059952a677edccb334cf85019219
Author: Christian Hergert <chergert redhat com>
Date:   Sat Sep 9 15:46:51 2017 -0700

    progress: be more graceful with invalid data
    
    It's not ideal, but we can just clamp these values.

 libide/util/ide-progress.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/libide/util/ide-progress.c b/libide/util/ide-progress.c
index ec93e40..d072f64 100644
--- a/libide/util/ide-progress.c
+++ b/libide/util/ide-progress.c
@@ -89,8 +89,8 @@ ide_progress_set_fraction (IdeProgress *self,
   gboolean do_notify = FALSE;
 
   g_return_if_fail (IDE_IS_PROGRESS (self));
-  g_return_if_fail (fraction >= 0.0);
-  g_return_if_fail (fraction <= 1.0);
+
+  fraction = CLAMP (fraction, 0.0, 1.0);
 
   g_mutex_lock (&self->mutex);
   if (self->fraction != fraction)


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