Skip to content

Conversation

@jserv
Copy link
Contributor

@jserv jserv commented Oct 19, 2025

This improves API Layer:

  • Add runtime NULL checks for all API functions
  • Add backend function pointer validation before use
  • Graceful error handling in release builds via log_error()
  • Fix twin_destroy() to validate context before backend exit

Summary by cubic

Hardened the API layer with runtime NULL checks and backend function-pointer validation to prevent crashes and improve error reporting in release builds. Also fixes context handling in twin_destroy.

  • Refactors
    • Add NULL checks and early returns in create/run/destroy/dispatch paths.
    • Validate backend init/start/exit/poll before calling; log clear errors when missing.
    • Make log_error/log_warn always active (remove CONFIG_LOGGING guards).

This improves API Layer:
- Add runtime NULL checks for all API functions
- Add backend function pointer validation before use
- Graceful error handling in release builds via log_error()
- Fix twin_destroy() to validate context before backend exit
Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

@jserv jserv merged commit 26e8cab into main Oct 19, 2025
9 checks passed
@jserv jserv deleted the refine-api branch October 19, 2025 10:27
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