Skip to content

Commit bed31d2

Browse files
committed
Bug fix: AccountBlockInfo.BlockId could be null for system blocks.
1 parent d4ab753 commit bed31d2

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

WikiClientLibrary/Sites/AccountInfo.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ public AccountBlockInfo? BlockInfo
7979
var localBlockInfo = this._BlockInfo;
8080
if (localBlockInfo == null)
8181
{
82+
// While `blockid` could be `null` for system blocks, the node always exists.
8283
if (extensionDataRaw != null
8384
&& extensionDataRaw.ContainsKey("blockid")
8485
&& extensionDataRaw.ContainsKey("blockedbyid")
@@ -236,12 +237,15 @@ public sealed class AccountBlockInfo
236237
{
237238

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

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

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

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

0 commit comments

Comments
 (0)