Skip to content

Commit

Permalink
Merge pull request #1996 from Scavanger/Defaults-Dialog-Fix2
Browse files Browse the repository at this point in the history
[7.1 RC1] Bugfix: Defaults Dialog hangs with SITL
  • Loading branch information
DzikuVx authored Mar 14, 2024
2 parents 966ee22 + c37f04e commit 7b32e9c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions js/msp/MSPHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down Expand Up @@ -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);
});
};

Expand Down

0 comments on commit 7b32e9c

Please sign in to comment.