Skip to content

Commit f89f2be

Browse files
committed
Address review feedback: unsigned shift and error handling
Use unsigned right-shift (>>>) for bitmask checks to avoid sign-extension issues when bit 31 is set. Use MSP.promise() with .catch() so done() is always called even if the mask fetch fails.
1 parent d606a4c commit f89f2be

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

tabs/osd.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2437,7 +2437,10 @@ OSD.reload = function(callback) {
24372437

24382438
MSP.promise(MSPCodes.MSP2_INAV_CUSTOM_OSD_ELEMENTS).then(() => {
24392439
mspHelper.loadOsdCustomElements(() => {
2440-
MSP.send_message(MSPCodes.MSP2_INAV_LOGIC_CONDITIONS_CONFIGURED, false, false, function() {
2440+
MSP.promise(MSPCodes.MSP2_INAV_LOGIC_CONDITIONS_CONFIGURED).then(() => {
2441+
createCustomElements();
2442+
done();
2443+
}).catch(() => {
24412444
createCustomElements();
24422445
done();
24432446
});
@@ -4181,8 +4184,8 @@ function getLCoptions(){
41814184
}
41824185
for (var i = 0; i < 64; i++) {
41834186
var isConfigured = (i < 32) ?
4184-
(mask.lower & (1 << i)) !== 0 :
4185-
(mask.upper & (1 << (i - 32))) !== 0;
4187+
((mask.lower >>> i) & 1) === 1 :
4188+
((mask.upper >>> (i - 32)) & 1) === 1;
41864189
if (isConfigured) {
41874190
result += '<option value="' + i + '">LC ' + i + '</option>';
41884191
}

0 commit comments

Comments
 (0)