From f09521447d81f6b409d3f0e8270eff45cd582a74 Mon Sep 17 00:00:00 2001 From: Laura Savino Date: Wed, 16 Apr 2014 18:47:26 -0700 Subject: [PATCH] Make sure LocalStore exists before trying to access it for the scratchpads Summary: This section assumes a LocalStore is set up, which isn't currently true on the iOS app (and may not be in the future, either). Checking its existence before accessing it avoids an exception. Test Plan: Ran khan-exercises in both the iOS and web apps; scratchpads work in the web still, and the iOS app doesn't throw an exception there. Reviewers: mgp, ben Reviewed By: mgp, ben Subscribers: marcos Differential Revision: http://phabricator.khanacademy.org/D8295 --- khan-exercise.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/khan-exercise.js b/khan-exercise.js index 62c56b8fd..8763a6018 100644 --- a/khan-exercise.js +++ b/khan-exercise.js @@ -889,7 +889,7 @@ function loadAndRenderExercise(nextUserExercise) { }).children(".problems").children(); // Make scratchpad persistent per-user - if (user) { + if (user && window.LocalStore) { var lastScratchpad = LocalStore.get("scratchpad:" + user); if (typeof lastScratchpad !== "undefined" && JSON.parse(lastScratchpad)) { Khan.scratchpad.show();