Skip to content

Guard Microsoft Update Catalog row parsing against null table cells - #25

Draft
OSDeploy with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-null-value-expression-warning
Draft

Guard Microsoft Update Catalog row parsing against null table cells#25
OSDeploy with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-null-value-expression-warning

Conversation

Copilot AI commented Aug 1, 2026

Copy link
Copy Markdown

Deploying with Deploy-OSDCloud -CLI could emit You cannot call a method on a null-value expression during Microsoft Update Catalog driver lookups. The failure path was triggered by unexpected/malformed catalog rows being parsed without null checks.

  • Root cause

    • Get-MicrosoftUpdateCatalogResult assumed every row had expected <td> nodes and called .InnerText.Trim() directly.
  • Code changes

    • Added defensive cell extraction in base filtering:
      • Skip rows when SelectNodes("td") is null or has fewer than required cells.
      • Read fields via safe string casts instead of direct method calls on potentially null values.
    • Added the same guard in architecture filtering to avoid null access on sparse rows.
  • Behavioral impact

    • Malformed/incomplete catalog rows are ignored instead of surfacing runtime null-method warnings.
    • Existing filtering behavior for valid rows is unchanged.
$cells = $_.SelectNodes("td")
if ($null -eq $cells -or $cells.Count -lt 4) {
    return $false
}

$title = [string]$cells[1].InnerText
$classification = [string]$cells[3].InnerText

Copilot AI changed the title [WIP] Fix warning: cannot call method on a null-value expression Guard Microsoft Update Catalog row parsing against null table cells Aug 1, 2026
Copilot AI requested a review from OSDeploy August 1, 2026 06:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Warning: You cannot call a method on a null-value expression

2 participants