From bf9fcd1bb8696bf3e15954ccdb591afb6a51ed2f Mon Sep 17 00:00:00 2001 From: Phil Pluckthun Date: Sun, 14 Jun 2020 19:21:13 +0100 Subject: [PATCH] Add missing mode reset and invalid EOF handling --- exchanges/graphcache/src/default-storage/index.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/exchanges/graphcache/src/default-storage/index.ts b/exchanges/graphcache/src/default-storage/index.ts index 26cc28434d..b4b831ab16 100644 --- a/exchanges/graphcache/src/default-storage/index.ts +++ b/exchanges/graphcache/src/default-storage/index.ts @@ -77,10 +77,14 @@ export const makeDefaultStorage = (opts?: StorageOptions): DefaultStorage => { index = 0; while (index < input.length) { - while ((char = input[index++]) !== ':') entry += char; + while ((char = input[index++]) !== ':' && char) { + entry += char; + } if (mode) { data[key] = deserializeEntry(entry) || undefined; + entry = ''; + mode = 0; } else { key = deserializeEntry(entry); entry = '';