Merge pull request #1274 from lioncash/uninit

TASInputDlg: Fix some potential uninitialized variable warnings.
This commit is contained in:
skidau 2014-10-15 13:25:52 +11:00
commit 9f5ea81ffe
1 changed files with 18 additions and 6 deletions

View File

@ -567,15 +567,18 @@ void TASInputDlg::GetValues(GCPadStatus* PadStatus)
void TASInputDlg::UpdateFromSliders(wxCommandEvent& event) void TASInputDlg::UpdateFromSliders(wxCommandEvent& event)
{ {
wxTextCtrl* text; wxTextCtrl* text = nullptr;
for (unsigned int i = 0; i < 10; ++i) for (unsigned int i = 0; i < 10; ++i)
{ {
if (Controls[i] != nullptr && event.GetId() == Controls[i]->Slider_ID) if (Controls[i] != nullptr && event.GetId() == Controls[i]->Slider_ID)
text = Controls[i]->Text; text = Controls[i]->Text;
} }
int value = ((wxSlider*) event.GetEventObject())->GetValue(); int value = ((wxSlider*) event.GetEventObject())->GetValue();
text->SetValue(std::to_string(value));
if (text)
text->SetValue(std::to_string(value));
} }
void TASInputDlg::UpdateFromText(wxCommandEvent& event) void TASInputDlg::UpdateFromText(wxCommandEvent& event)
@ -718,20 +721,29 @@ void TASInputDlg::OnMouseDownL(wxMouseEvent& event)
void TASInputDlg::SetTurbo(wxMouseEvent& event) void TASInputDlg::SetTurbo(wxMouseEvent& event)
{ {
Button* button; Button* button = nullptr;
for (unsigned int i = 0; i < 14; ++i) for (unsigned int i = 0; i < 14; ++i)
{ {
if (Buttons[i] != nullptr && event.GetId() == Buttons[i]->ID) if (Buttons[i] != nullptr && event.GetId() == Buttons[i]->ID)
button = Buttons[i]; button = Buttons[i];
} }
if (event.LeftDown()) if (event.LeftDown())
{ {
button->TurboOn = false; if (button)
button->TurboOn = false;
event.Skip(true); event.Skip(true);
return; return;
} }
button->Checkbox->SetValue(true);
button->TurboOn = !button->TurboOn; if (button)
{
button->Checkbox->SetValue(true);
button->TurboOn = !button->TurboOn;
}
event.Skip(true); event.Skip(true);
} }