Skip to content

Commit fbaa47c

Browse files
committed
chore: minor optimization
1 parent 2a8cb4f commit fbaa47c

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

VRCFTPicoModule/Utils/Updater.cs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,15 @@ namespace VRCFTPicoModule.Utils
1111
{
1212
public class Updater()
1313
{
14-
#pragma warning disable CS8618 // Non-nullable field is **initialized**.
15-
private readonly UdpClient _udpClient;
16-
private readonly ILogger _logger;
17-
#pragma warning restore CS8618
14+
private readonly UdpClient? _udpClient;
15+
private readonly ILogger? _logger;
1816
private readonly bool _isLegacy;
1917
private readonly (bool, bool) _trackingAvailable;
2018

2119
public Updater(UdpClient udpClient, ILogger logger, bool isLegacy, (bool, bool) trackingAvailable) : this()
2220
{
23-
_udpClient = udpClient ?? throw new ArgumentNullException(nameof(udpClient));
24-
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
21+
_udpClient = udpClient;
22+
_logger = logger;
2523
_isLegacy = isLegacy;
2624
_trackingAvailable = trackingAvailable;
2725
}
@@ -34,6 +32,12 @@ public Updater(UdpClient udpClient, ILogger logger, bool isLegacy, (bool, bool)
3432

3533
public void Update(ModuleState state)
3634
{
35+
if (_udpClient == null)
36+
return;
37+
38+
if (_logger == null)
39+
return;
40+
3741
_udpClient.Client.ReceiveTimeout = 100;
3842
_moduleState = state;
3943

0 commit comments

Comments
 (0)