Skip to content

Commit 7a9a541

Browse files
Gary KeebleGary Keeble
authored andcommitted
Merge branch 'Custom-Motor-Mixes'
2 parents a455b79 + a0cb2e7 commit 7a9a541

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

js/user_settings_dialog.js

100755100644
Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
function UserSettingsDialog(dialog, onSave) {
44

55
// Private Variables
6-
var that = this; // generic pointer back to this function
76
var mixerConfiguration = 3; // mixerConfiguration starts at 1;
87

98
var customMix = null;
@@ -65,7 +64,7 @@ function UserSettingsDialog(dialog, onSave) {
6564
return settings;
6665
}
6766

68-
var availableMotors; // motors that appear in the log file
67+
var availableMotors =[]; // motors that appear in the log file
6968
function getAvailableMotors(flightLog) {
7069

7170
var fieldNames = flightLog.getMainFieldNames();
@@ -141,10 +140,13 @@ function UserSettingsDialog(dialog, onSave) {
141140

142141
function mixerListSelection(val) {
143142

144-
if(val===null) val=3; // default for invalid values
143+
if(val==null) val=3; // default for invalid values
144+
145145
mixerConfiguration = val;
146146

147-
$('.mixerPreview img').attr('src', './images/motor_order/' + mixerList[val - 1].image + '.svg');
147+
if(val>0 && val <= mixerList.length) {
148+
$('.mixerPreview img').attr('src', './images/motor_order/' + mixerList[val - 1].image + '.svg');
149+
}
148150

149151
buildMotorList(mixerConfiguration); // rebuild the motor list based upon the current selection
150152
}
@@ -195,6 +197,6 @@ function UserSettingsDialog(dialog, onSave) {
195197

196198
dialog.modal('show');
197199

198-
}
200+
};
199201

200202
}

0 commit comments

Comments
 (0)