Fix Issue 102, missing null check in index_handler() (#103)
parent
fec860da0e
commit
49ecd1a2b6
|
@ -648,11 +648,17 @@ static esp_err_t index_handler(httpd_req_t *req){
|
||||||
httpd_resp_set_type(req, "text/html");
|
httpd_resp_set_type(req, "text/html");
|
||||||
httpd_resp_set_hdr(req, "Content-Encoding", "gzip");
|
httpd_resp_set_hdr(req, "Content-Encoding", "gzip");
|
||||||
sensor_t * s = esp_camera_sensor_get();
|
sensor_t * s = esp_camera_sensor_get();
|
||||||
|
if (s != NULL) {
|
||||||
if (s->id.PID == OV3660_PID) {
|
if (s->id.PID == OV3660_PID) {
|
||||||
return httpd_resp_send(req, (const char *)index_ov3660_html_gz_start, index_ov3660_html_gz_len);
|
return httpd_resp_send(req, (const char *)index_ov3660_html_gz_start, index_ov3660_html_gz_len);
|
||||||
}
|
} else {
|
||||||
return httpd_resp_send(req, (const char *)index_ov2640_html_gz_start, index_ov2640_html_gz_len);
|
return httpd_resp_send(req, (const char *)index_ov2640_html_gz_start, index_ov2640_html_gz_len);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
ESP_LOGE(TAG,"Camera sensor not found");
|
||||||
|
return httpd_resp_send_500(req);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void app_httpd_main(){
|
void app_httpd_main(){
|
||||||
httpd_config_t config = HTTPD_DEFAULT_CONFIG();
|
httpd_config_t config = HTTPD_DEFAULT_CONFIG();
|
||||||
|
|
Loading…
Reference in New Issue