From b20c69b15a41cd86383fd78e1511a63ab287bdf4 Mon Sep 17 00:00:00 2001 From: orangemug Date: Wed, 29 Nov 2017 18:00:52 +0000 Subject: [PATCH] Catch invalid color during parse. --- src/components/fields/ColorField.jsx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/components/fields/ColorField.jsx b/src/components/fields/ColorField.jsx index 1ff229a..73776c6 100644 --- a/src/components/fields/ColorField.jsx +++ b/src/components/fields/ColorField.jsx @@ -50,7 +50,16 @@ class ColorField extends React.Component { } get color() { - return Color(this.props.value || '#fff').rgb() + let color = Color("rgb(255,255,255)"); + + // Catch invalid color. + try { + return Color(this.props.value).rgb() + } + catch(err) { + console.warn("Error parsing color: ", err); + } + return color; } render() {