esp_event_send: check if the event loop is initialized

Fixes https://github.com/espressif/esp-idf/issues/668
This commit is contained in:
Ivan Grokhotkov 2017-06-05 11:01:26 +08:00
parent e45a288516
commit 17da994345

View File

@ -72,6 +72,10 @@ system_event_cb_t esp_event_loop_set_cb(system_event_cb_t cb, void *ctx)
esp_err_t esp_event_send(system_event_t *event)
{
if (s_event_queue == NULL) {
ESP_LOGE(TAG, "Event loop not initialized via esp_event_loop_init, but esp_event_send called");
return ESP_ERR_INVALID_STATE;
}
portBASE_TYPE ret = xQueueSendToBack(s_event_queue, event, 0);
if (ret != pdPASS) {
if (event) {