From ad6d48bd6e1ea2fa417b8e9031bf2a7027abb745 Mon Sep 17 00:00:00 2001 From: santhosh H Date: Wed, 18 Sep 2019 17:13:46 +0530 Subject: [PATCH] update getByPathh.js if root = {a : {b : 100}} and path=["a","b","c"] previously available code would crash. --- packages/fbjs/src/misc/getByPath.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/fbjs/src/misc/getByPath.js b/packages/fbjs/src/misc/getByPath.js index 79037692..f35c4d8e 100644 --- a/packages/fbjs/src/misc/getByPath.js +++ b/packages/fbjs/src/misc/getByPath.js @@ -42,7 +42,7 @@ function getByPath( const segment = path[i]; // Use 'in' to check entire prototype chain since immutable js records // use prototypes - if (current && segment in current) { + if (typeof(current) == "object" && segment in current) { current = current[segment]; } else { return fallbackValue;