From c37f04eb09ba8ecadf06929a5d9f543ae469764c Mon Sep 17 00:00:00 2001 From: Scavanger Date: Wed, 13 Mar 2024 12:14:20 -0300 Subject: [PATCH] Bugfix: Defaults Dialog --- js/msp/MSPHelper.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/js/msp/MSPHelper.js b/js/msp/MSPHelper.js index ba43e0f79..bcfd746fe 100644 --- a/js/msp/MSPHelper.js +++ b/js/msp/MSPHelper.js @@ -3421,6 +3421,11 @@ var mspHelper = (function (gui) { self.encodeSetting = function (name, value) { return this._getSetting(name).then(function (setting) { + + if (!setting) { + throw 'Invalid setting'; + } + if (setting.table && !Number.isInteger(value)) { var found = false; for (var ii = 0; ii < setting.table.values.length; ii++) { @@ -3469,6 +3474,9 @@ var mspHelper = (function (gui) { self.setSetting = function (name, value, callback) { this.encodeSetting(name, value).then(function (data) { return MSP.promise(MSPCodes.MSPV2_SET_SETTING, data).then(callback); + }).catch(error => { + console.log("Invalid setting: " + name); + return new Promise(callback); }); };