Code

Fixed assertion failure with some unset parameters for feComposite & feOffset
authorkiirala <kiirala@users.sourceforge.net>
Sat, 14 Jul 2007 21:54:16 +0000 (21:54 +0000)
committerkiirala <kiirala@users.sourceforge.net>
Sat, 14 Jul 2007 21:54:16 +0000 (21:54 +0000)
src/sp-fecomposite.cpp
src/sp-feoffset.cpp

index 68312aa1b9ffd95a046ad120d1e34683f23a263e..b191f982657f0bfac3d39b71bab5dfd472c9da8d 100644 (file)
@@ -122,6 +122,8 @@ sp_feComposite_release(SPObject *object)
 
 static double
 sp_feComposite_read_number(gchar const *value) {
+    if (!value) return 0;
+
     char *end;
     double ret = g_ascii_strtod(value, &end);
     if (*end) {
index 284846855e2c64277b0aeddeeb328b0380b3634b..03d8b6227502b7a21831c7a46cd37ff7fdccc74c 100644 (file)
@@ -111,6 +111,7 @@ sp_feOffset_release(SPObject *object)
 
 static double
 sp_feOffset_read_number(gchar const *value) {
+    if (!value) return 0;
     char *end;
     double ret = g_ascii_strtod(value, &end);
     if (*end) {
@@ -130,14 +131,21 @@ sp_feOffset_set(SPObject *object, unsigned int key, gchar const *value)
 {
     SPFeOffset *feOffset = SP_FEOFFSET(object);
 
+    double read_num;
     switch(key) {
         case SP_ATTR_DX:
-            feOffset->dx = sp_feOffset_read_number(value);
-            object->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
+            read_num = sp_feOffset_read_number(value);
+            if (read_num != feOffset->dx) {
+                feOffset->dx = read_num;
+                object->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
+            }
             break;
         case SP_ATTR_DY:
-            feOffset->dy = sp_feOffset_read_number(value);
-            object->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
+            read_num = sp_feOffset_read_number(value);
+            if (read_num != feOffset->dy) {
+                feOffset->dy = read_num;
+                object->parent->requestModified(SP_OBJECT_MODIFIED_FLAG);
+            }
             break;
             
        /*DEAL WITH SETTING ATTRIBUTES HERE*/