Handle invalid JSON input in the theme settings editor (#1562)

* Handle invalid JSON input in the theme settings editor
This commit is contained in:
Kevin Chung
2020-07-22 01:45:37 -04:00
committed by GitHub
parent 98b9dda58c
commit bea74c2068
3 changed files with 11 additions and 3 deletions

View File

@@ -276,7 +276,15 @@ $(() => {
$("#theme-settings-button").click(function() {
let form = $("#theme-settings-modal form");
let data = JSON.parse(theme_settings_editor.getValue());
let data;
// Ignore invalid JSON data
try {
data = JSON.parse(theme_settings_editor.getValue());
} catch (e) {
data = {};
}
$.each(data, function(key, value) {
var ctrl = form.find(`[name='${key}']`);
switch (ctrl.prop("type")) {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long