Skip to content

fix(modem): Add asserts and params error checks on create path - #1119

Open
david-cermak wants to merge 1 commit into
espressif:masterfrom
david-cermak:fix/modem_api_asserts
Open

fix(modem): Add asserts and params error checks on create path#1119
david-cermak wants to merge 1 commit into
espressif:masterfrom
david-cermak:fix/modem_api_asserts

Conversation

@david-cermak

@david-cermak david-cermak commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator

Follow up from #1102


Note

Low Risk
Small guardrails on creation only; behavior for valid callers is unchanged and invalid null args now fail safely instead of undefined behavior.

Overview
Adds defensive null-pointer validation on modem initialization so invalid callers fail early instead of dereferencing null configs or DTE handles.

On the C++ factory path, create_vfs_dte, create_uart_dte, and shared create_modem_dce now use ESP_MODEM_THROW_IF_FALSE for null dte/dce config and null dte before building terminals or DCE instances (still surfaced as nullptr via TRY_CATCH_RET_NULL when exceptions are enabled).

On the C API, esp_modem_new_dev returns nullptr immediately if dte_config or dce_config is null, before allocating the wrapper or calling into UART DTE creation.

Reviewed by Cursor Bugbot for commit 5a435de. Bugbot is set up for automated code reviews on this repo. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant