From f235dcb38c0de1ce3fc0f86fc447a195d3b467b0 Mon Sep 17 00:00:00 2001 From: Logan Tegman Date: Thu, 25 Feb 2016 11:14:09 -0800 Subject: [PATCH] Prevent validator being called on non-strings --- common/app/routes/Jobs/components/NewJob.jsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/common/app/routes/Jobs/components/NewJob.jsx b/common/app/routes/Jobs/components/NewJob.jsx index 3683895f71..83aba5ee5b 100644 --- a/common/app/routes/Jobs/components/NewJob.jsx +++ b/common/app/routes/Jobs/components/NewJob.jsx @@ -61,15 +61,15 @@ const checkboxClass = dedent` `; function formatValue(value, validator, type = 'string') { - const formated = getDefaults(type); - if (validator && type === 'string') { - formated.valid = validator(value); + const formatted = getDefaults(type); + if (validator && type === 'string' && typeof value === 'string') { + formatted.valid = validator(value); } if (value) { - formated.value = value; - formated.bsStyle = formated.valid ? 'success' : 'error'; + formatted.value = value; + formatted.bsStyle = formatted.valid ? 'success' : 'error'; } - return formated; + return formatted; } const normalizeOptions = {