fix: allow null URI send

This commit is contained in:
Oliver Booth 2024-05-28 16:52:34 +01:00
parent 3047c89fdc
commit 95025c6a3a
Signed by: oliverbooth
GPG Key ID: E60B570D1B7557B5
1 changed files with 3 additions and 9 deletions

View File

@ -280,17 +280,11 @@ public sealed class VirtualParadiseAvatar : IEquatable<VirtualParadiseAvatar>
/// <summary> /// <summary>
/// Sends a URI to this avatar. /// Sends a URI to this avatar.
/// </summary> /// </summary>
/// <param name="uri">The URI to send.</param> /// <param name="uri">The URI to send. <see langword="null" /> will remove the overlay for the user.</param>
/// <param name="target">The URL target. See <see cref="UriTarget" /> for more information.</param> /// <param name="target">The URL target. See <see cref="UriTarget" /> for more information.</param>
/// <exception cref="InvalidOperationException">The action cannot be performed on the client's current avatar.</exception> /// <exception cref="InvalidOperationException">The action cannot be performed on the client's current avatar.</exception>
/// <exception cref="ArgumentNullException"><paramref name="uri" /> is <see langword="null" />.</exception> public Task SendUriAsync(Uri? uri, UriTarget target = UriTarget.Browser)
public Task SendUriAsync(Uri uri, UriTarget target = UriTarget.Browser)
{ {
if (uri is null)
{
throw new ArgumentNullException(nameof(uri));
}
// ReSharper disable once InconsistentlySynchronizedField // ReSharper disable once InconsistentlySynchronizedField
if (this == _client.CurrentAvatar) if (this == _client.CurrentAvatar)
{ {
@ -299,7 +293,7 @@ public sealed class VirtualParadiseAvatar : IEquatable<VirtualParadiseAvatar>
lock (_client.Lock) lock (_client.Lock)
{ {
_ = vp_url_send(_client.NativeInstanceHandle, Session, uri.ToString(), target); _ = vp_url_send(_client.NativeInstanceHandle, Session, uri?.ToString() ?? string.Empty, target);
} }
return Task.CompletedTask; return Task.CompletedTask;