aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYamagishi Kazutoshi <ykzts@desire.sh>2018-01-26 15:12:16 +0900
committerAndrew Bonventre <andybons@golang.org>2018-01-29 22:16:22 +0000
commit8e3b0c2fe87f92ea28e34688bf90a281b991f4ce (patch)
tree6633e61387a178fa8e16fb6fc9ae8a9f34e2370b
parent8d672c900895404ef380aca75be10fa82f191f84 (diff)
downloadgolang-id-tour-8e3b0c2fe87f92ea28e34688bf90a281b991f4ce.tar.xz
tour: check if file content is set before storing in localStorage
file() returns undefined when there is no file to display, like on https://tour.golang.org/welcome/2 Change-Id: Ia26719537949c9909947068d790f07e2eee8f9ff Reviewed-on: https://go-review.googlesource.com/90075 Reviewed-by: Andrew Bonventre <andybons@golang.org>
-rwxr-xr-xstatic/js/controllers.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/static/js/controllers.js b/static/js/controllers.js
index e035544..c64fb04 100755
--- a/static/js/controllers.js
+++ b/static/js/controllers.js
@@ -22,7 +22,7 @@ controller('EditorCtrl', ['$scope', '$routeParams', '$location', 'toc', 'i18n',
var f = file();
return f && f.Content;
}, function(val) {
- storage.set(file().Hash, val);
+ if (val) storage.set(file().Hash, val);
});
});