Skip to content

Fix: add null checks in RssAccessor.GetData#30

Open
HashidaTKS wants to merge 1 commit intomasterfrom
fix/rss-accessor-null-check
Open

Fix: add null checks in RssAccessor.GetData#30
HashidaTKS wants to merge 1 commit intomasterfrom
fix/rss-accessor-null-check

Conversation

@HashidaTKS
Copy link
Copy Markdown
Owner

問題点

RssAccessor.GetData() で以下の null チェックが欠如していた。

  1. element.Element("channel") の戻り値 — RSS フィードに <channel> 要素がない場合に null が返り、続く .Elements("item")NullReferenceException
  2. <item> の子要素 (title / link / description) — 要素が存在しない場合に .Value アクセスで NullReferenceException

改善内容

  • channelElement == null の場合は空のシーケンスを返す
  • title / link / description のいずれかが欠損している <item> はフィルタリングして RssDatum 生成をスキップ

Test plan

  • 正常な RSS フィードでデータが取得されることを確認
  • <channel> 要素が存在しない RSS フィードでも例外が発生しないことを確認
  • 子要素が不完全な <item> がスキップされることを確認

🤖 Generated with Claude Code

…sAccessor

element.Element("channel") returns null when the RSS feed lacks a <channel>
element, causing NullReferenceException on channelElement.Elements("item").
Similarly, each <item>'s child elements (title/link/description) can be
absent, causing Value access on null XElement.

Add a null guard for channelElement returning an empty sequence, and filter
out items that are missing required child elements before constructing RssDatum.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

1 participant