From b8e16bbbfd0589b3dee8d41a25b78de32da8d03a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Wed, 26 Feb 2014 12:27:32 +0000
Subject: [PATCH] Make sure number properties are not Nan

---
 dream/platform/static/src/dream.js | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/dream/platform/static/src/dream.js b/dream/platform/static/src/dream.js
index 2e3975e4..c31245d2 100644
--- a/dream/platform/static/src/dream.js
+++ b/dream/platform/static/src/dream.js
@@ -163,7 +163,7 @@
                   prefixed_property_id = prefix + property.id;
                   property_element = $("#" + prefixed_property_id);
                   data[property.id] = property_element.val();
-                  if (property.type === "number") {
+                  if (property.type === "number" && data[property.id] !== "") {
                     data[property.id] = parseFloat(data[property.id])
                   }
                 } else if (property._class === "Dream.PropertyList") {
@@ -252,7 +252,7 @@
           if (property._class === "Dream.Property") {
             prefixed_property_id = prefix + property.id;
             properties[property.id] = $("#" + prefixed_property_id).val();
-            if (property.type === "number") {
+            if (property.type === "number" && properties[property.id] !== "") {
               properties[property.id] = parseFloat(properties[property.id])
             }
           }
-- 
2.30.9