Skip to content

Commit

Permalink
Bug fix: AccountBlockInfo.BlockId could be null for system blocks.
Browse files Browse the repository at this point in the history
  • Loading branch information
CXuesong committed Sep 1, 2024
1 parent d4ab753 commit bed31d2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion WikiClientLibrary/Sites/AccountInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ public AccountBlockInfo? BlockInfo
var localBlockInfo = this._BlockInfo;
if (localBlockInfo == null)
{
// While `blockid` could be `null` for system blocks, the node always exists.
if (extensionDataRaw != null
&& extensionDataRaw.ContainsKey("blockid")
&& extensionDataRaw.ContainsKey("blockedbyid")
Expand Down Expand Up @@ -236,12 +237,15 @@ public sealed class AccountBlockInfo
{

/// <summary>ID of the block.</summary>
public required long BlockId { get; init; }
/// <value>block ID, or <c>null</c> if the block is a system block (see <see cref="SystemBlockType"/>).</value>
public required long? BlockId { get; init; }

/// <summary>Username of the blocker.</summary>
/// <value>username, or empty string (<c>""</c>) if the block is a system block.</value>
public required string BlockedBy { get; init; }

/// <summary>User ID of the blocker.</summary>
/// <value>username, or <c>0</c> if the block is a system block.</value>
public required long BlockedById { get; init; }

/// <summary>Reason provided for the block, in Wikitext.</summary>
Expand Down

0 comments on commit bed31d2

Please sign in to comment.