Skip to content
This repository has been archived by the owner on May 11, 2021. It is now read-only.

Commit

Permalink
Make sure LocalStore exists before trying to access it for the scratc…
Browse files Browse the repository at this point in the history
…hpads

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
  • Loading branch information
lsavino committed Apr 17, 2014
1 parent 8b9ea2d commit f095214
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion khan-exercise.js
Expand Up @@ -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();
Expand Down

0 comments on commit f095214

Please sign in to comment.