Avoid using uninitialised data.
Signed-off-by: Andrea Odetti <mariofutire@gmail.com>
This commit is contained in:
parent
3733da1af7
commit
3231f86f87
2 changed files with 9 additions and 1 deletions
|
@ -190,13 +190,17 @@ Preferences::Data Preferences::getData() const
|
|||
data.mouseInSlot4 = mouse_4->isChecked();
|
||||
data.cpmInSlot5 = cpm_5->isChecked();
|
||||
data.hdInSlot7 = hd_7->isChecked();
|
||||
data.joystick = joystick->currentText();
|
||||
|
||||
if (joystick->currentIndex() >= 1)
|
||||
{
|
||||
const QVariant & device = joystick->itemData(joystick->currentIndex());
|
||||
data.joystick = joystick->currentText();
|
||||
data.joystickId = device.toInt();
|
||||
}
|
||||
else
|
||||
{
|
||||
data.joystickId = 0;
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
|
|
@ -317,6 +317,10 @@ void QApple::on_actionOptions_triggered()
|
|||
currentOptions.joystick = myGamepad->name();
|
||||
currentOptions.joystickId = myGamepad->deviceId();
|
||||
}
|
||||
else
|
||||
{
|
||||
currentOptions.joystickId = 0;
|
||||
}
|
||||
|
||||
QSettings settings; // the function will "modify" it
|
||||
myPreferences.setup(currentOptions, settings);
|
||||
|
|
Loading…
Add table
Reference in a new issue