Skip to content

Commit 14d7b5f

Browse files
meee1Copilot
andauthored
Update Joystick/JoystickSetup.cs
Co-authored-by: Copilot <[email protected]>
1 parent 8a63858 commit 14d7b5f

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

Joystick/JoystickSetup.cs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -541,8 +541,21 @@ private void but_export_Click(object sender, EventArgs e)
541541
sfd.Filter = "Joystick config files (*.joycfg)|*.joycfg|All files (*.*)|*.*";
542542
if (sfd.ShowDialog() == DialogResult.OK)
543543
{
544-
MainV2.joystick.saveconfig();
545-
MainV2.joystick.ExportConfig(sfd.FileName);
544+
if (MainV2.joystick == null)
545+
{
546+
CustomMessageBox.Show("No joystick configuration is available to export.", "Export Joystick Config", MessageBoxButtons.OK);
547+
return;
548+
}
549+
550+
try
551+
{
552+
MainV2.joystick.saveconfig();
553+
MainV2.joystick.ExportConfig(sfd.FileName);
554+
}
555+
catch (Exception ex)
556+
{
557+
CustomMessageBox.Show("Failed to export joystick configuration:\n" + ex.Message, "Export Joystick Config", MessageBoxButtons.OK);
558+
}
546559
}
547560
}
548561

0 commit comments

Comments
 (0)