summaryrefslogtreecommitdiffstats
path: root/src/object/sp-object.cpp
diff options
context:
space:
mode:
authorMarc Jeanmougin <marc@jeanmougin.fr>2018-10-07 16:07:03 +0000
committerMarc Jeanmougin <marc@jeanmougin.fr>2018-10-07 16:07:03 +0000
commit0ffe338027ba1eb9817c3eabb62be6d9a4edff87 (patch)
tree2434fb5741c0ded4d259d22848e4d2bde409416d /src/object/sp-object.cpp
parentFix crash when viewing an image with invalid coords (NaN or inf) (diff)
downloadinkscape-0ffe338027ba1eb9817c3eabb62be6d9a4edff87.tar.gz
inkscape-0ffe338027ba1eb9817c3eabb62be6d9a4edff87.zip
sensible behavior when reading NaN values
Diffstat (limited to 'src/object/sp-object.cpp')
-rw-r--r--src/object/sp-object.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/object/sp-object.cpp b/src/object/sp-object.cpp
index 7c6b6c28d..4a9a347c1 100644
--- a/src/object/sp-object.cpp
+++ b/src/object/sp-object.cpp
@@ -996,6 +996,14 @@ void SPObject::readAttr(gchar const *key)
if (keyid != SP_ATTR_INVALID) {
/* Retrieve the 'key' attribute from the object's XML representation */
gchar const *value = getRepr()->attribute(key);
+ if (value &&
+ (!strcmp(value, "nan")
+ || !strcmp(value, "-nan")
+ || !strcmp(value, "NaN")
+ || !strcmp(value, "-NaN")
+ )) {
+ value = nullptr;
+ }
setKeyValue(keyid, value);
}