Skip to content

Fix potential runtime error from unguarded image array access in PostSimple - #112

Closed
qmauvnt with Copilot wants to merge 2 commits into
ui-v3from
copilot/sub-pr-110-again
Closed

Fix potential runtime error from unguarded image array access in PostSimple#112
qmauvnt with Copilot wants to merge 2 commits into
ui-v3from
copilot/sub-pr-110-again

Conversation

Copilot AI commented Feb 19, 2026

Copy link
Copy Markdown

Accessing prev.images[0] and next.images[0] without optional chaining throws at runtime when a post's images field is undefined.

Changes

  • layouts/PostSimple.js: Use optional chaining on images array access for both prev and next navigation cards
// Before
image={prev.images[0]}
image={next.images[0]}

// After
image={prev.images?.[0]}
image={next.images?.[0]}

When images is absent, the expression evaluates to undefined, and HorizontalCard already falls back to /static/images/default-ogp.png.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: qmauvnt <10303945+qmauvnt@users.noreply.github.com>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Feb 19, 2026

Copy link
Copy Markdown

Deploying vntechies-blog with  Cloudflare Pages  Cloudflare Pages

Latest commit: ba0101a
Status: ✅  Deploy successful!
Preview URL: https://51cf691d.blog-68k.pages.dev
Branch Preview URL: https://copilot-sub-pr-110-again.blog-68k.pages.dev

View logs

Copilot AI changed the title [WIP] Update to address feedback from review on vntechies v3 PR Fix potential runtime error from unguarded image array access in PostSimple Feb 19, 2026
Copilot AI requested a review from qmauvnt February 19, 2026 21:43
@qmauvnt qmauvnt closed this Feb 20, 2026
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.

2 participants