diff --git a/src/Input/Input.cs b/src/Input/Input.cs
index 4700d2c..e6c1d2d 100644
--- a/src/Input/Input.cs
+++ b/src/Input/Input.cs
@@ -41,7 +41,7 @@ namespace MoonWorks.Input
/// Called when a gamepad has been connected.
///
/// The slot where the connection occurred.
- public OnGamepadConnectedFunc OnGamepadConnected;
+ public OnGamepadConnectedFunc OnGamepadConnected = delegate { };
public delegate void OnGamepadDisconnectedFunc(int slot);
@@ -49,7 +49,7 @@ namespace MoonWorks.Input
/// Called when a gamepad has been disconnected.
///
/// The slot where the disconnection occurred.
- public OnGamepadDisconnectedFunc OnGamepadDisconnected;
+ public OnGamepadDisconnectedFunc OnGamepadDisconnected = delegate { };
internal Inputs()
{
@@ -142,7 +142,11 @@ namespace MoonWorks.Input
{
Gamepads[slot].Register(openResult);
Logger.LogInfo($"Gamepad added to slot {slot}!");
- OnGamepadConnected(slot);
+
+ if (OnGamepadConnected != null)
+ {
+ OnGamepadConnected(slot);
+ }
}
return;