aboutsummaryrefslogtreecommitdiffstats
path: root/src/number.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/number.js')
-rw-r--r--src/number.js22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/number.js b/src/number.js
index 8cbf93a..8ca1422 100644
--- a/src/number.js
+++ b/src/number.js
@@ -13,16 +13,18 @@ SVG.Number = function(value) {
case 'string':
var match = value.match(SVG.regex.unit)
- /* make value numeric */
- this.value = parseFloat(match[1])
-
- /* normalize percent value */
- if (match[2] == '%')
- this.value /= 100
-
- /* store unit */
- this.unit = match[2]
-
+ if (match) {
+ /* make value numeric */
+ this.value = parseFloat(match[1])
+
+ /* normalize percent value */
+ if (match[2] == '%')
+ this.value /= 100
+
+ /* store unit */
+ this.unit = match[2]
+ }
+
break
default:
if (value instanceof SVG.Number) {