Merge branch 'bugfix/esp_event_send_init_check' into 'master'

esp_event_send: check if the event loop is initialized

See merge request !817
This commit is contained in:
Ivan Grokhotkov 2017-06-14 09:11:50 +08:00
commit 71d7716a45

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) {