Skip to content

fix: handle null memos in getActiveJobs to prevent runtime error#194

Open
Kubudak90 wants to merge 1 commit intoVirtual-Protocol:mainfrom
Kubudak90:main
Open

fix: handle null memos in getActiveJobs to prevent runtime error#194
Kubudak90 wants to merge 1 commit intoVirtual-Protocol:mainfrom
Kubudak90:main

Conversation

@Kubudak90
Copy link

Fixes #10

Problem

When job.memos is null or undefined from the API response, calling .map() throws a TypeError.

Solution

Add optional chaining with nullish coalescing: (job.memos ?? [])

Changes

  • src/acpClient.ts: Added null safety for memos mapping
  • test/unit/acpClient.test.ts: Added test case for null memos

Testing

All 50 unit tests pass.

Add optional chaining (?? []) when mapping job.memos to prevent
TypeError when memos is null or undefined from API response.

Fixes Virtual-Protocol#10
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