mirror of
https://github.com/oliverbooth/VpSharp
synced 2024-11-22 19:18:47 +00:00
Fix nullability (again)
This commit is contained in:
parent
a8e5fafbb4
commit
c2748567fc
@ -11,7 +11,7 @@ internal sealed class Connection : IDisposable
|
|||||||
|
|
||||||
private byte[] _pendingBuffer;
|
private byte[] _pendingBuffer;
|
||||||
private readonly List<byte[]> _readyBuffers = new();
|
private readonly List<byte[]> _readyBuffers = new();
|
||||||
private Timer _timer;
|
private Timer? _timer;
|
||||||
private nint _vpConnection;
|
private nint _vpConnection;
|
||||||
|
|
||||||
public Connection(nint vpConnection, object lockObject)
|
public Connection(nint vpConnection, object lockObject)
|
||||||
@ -65,8 +65,8 @@ internal sealed class Connection : IDisposable
|
|||||||
{
|
{
|
||||||
GCHandle handle = GCHandle.FromIntPtr(ptr);
|
GCHandle handle = GCHandle.FromIntPtr(ptr);
|
||||||
var connection = handle.Target as Connection;
|
var connection = handle.Target as Connection;
|
||||||
string host = Marshal.PtrToStringAnsi(hostPtr);
|
string? host = Marshal.PtrToStringAnsi(hostPtr);
|
||||||
if (connection is not null)
|
if (connection is not null && host is not null)
|
||||||
{
|
{
|
||||||
return connection.Connect(host, port);
|
return connection.Connect(host, port);
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ public sealed partial class VirtualParadiseClient
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
VirtualParadiseObject virtualParadiseObject = reason == ReasonCode.Success ? await ExtractObjectAsync(sender) : null;
|
VirtualParadiseObject? virtualParadiseObject = reason == ReasonCode.Success ? await ExtractObjectAsync(sender).ConfigureAwait(true) : null;
|
||||||
taskCompletionSource.SetResult((reason, virtualParadiseObject));
|
taskCompletionSource.SetResult((reason, virtualParadiseObject));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -244,7 +244,7 @@ public sealed partial class VirtualParadiseClient
|
|||||||
virtualParadiseObject = null;
|
virtualParadiseObject = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
_objects.TryRemove(objectId, out VirtualParadiseObject? _);
|
_objects.TryRemove(objectId, out VirtualParadiseObject _);
|
||||||
|
|
||||||
var args = new ObjectDeletedEventArgs(avatar!, objectId, virtualParadiseObject!);
|
var args = new ObjectDeletedEventArgs(avatar!, objectId, virtualParadiseObject!);
|
||||||
RaiseEvent(ObjectDeleted, args);
|
RaiseEvent(ObjectDeleted, args);
|
||||||
|
@ -98,7 +98,7 @@ public sealed partial class VirtualParadiseClient
|
|||||||
ReasonCode reason;
|
ReasonCode reason;
|
||||||
|
|
||||||
if (!_objectCompletionSources.TryGetValue(id,
|
if (!_objectCompletionSources.TryGetValue(id,
|
||||||
out TaskCompletionSource<(ReasonCode, VirtualParadiseObject?)>? taskCompletionSource))
|
out TaskCompletionSource<(ReasonCode, VirtualParadiseObject)>? taskCompletionSource))
|
||||||
{
|
{
|
||||||
taskCompletionSource = new TaskCompletionSource<(ReasonCode, VirtualParadiseObject?)>();
|
taskCompletionSource = new TaskCompletionSource<(ReasonCode, VirtualParadiseObject?)>();
|
||||||
_objectCompletionSources.TryAdd(id, taskCompletionSource);
|
_objectCompletionSources.TryAdd(id, taskCompletionSource);
|
||||||
|
Loading…
Reference in New Issue
Block a user