[dia] Avoid endless loop when trying to revert an empty list of object changes



commit 3fd642c0ff539d3b1e9be848ff35f3e1fa02f327
Author: Hans Breuer <hans breuer org>
Date:   Sat May 14 21:23:10 2011 +0200

    Avoid endless loop when trying to revert an empty list of object changes

 lib/objchange.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
---
diff --git a/lib/objchange.c b/lib/objchange.c
index 88bd672..7695e84 100644
--- a/lib/objchange.c
+++ b/lib/objchange.c
@@ -108,6 +108,9 @@ _change_list_revert (ObjectChange *change_list, DiaObject *obj)
   ObjectChangeList *list = (ObjectChangeList *)change_list;
   guint i;
   
+  if (list->changes->len < 1)
+    return; /* avoid overflow below */
+
   for (i = list->changes->len - 1;/* i >= 0 */; --i) {
     ObjectChange * change = (ObjectChange *)g_ptr_array_index(list->changes, i);
     



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