mirror of
https://github.com/esphome/esphome.git
synced 2026-09-14 16:48:40 +00:00
[http_request] Guard against empty firmware_url before path merge
Accessing path[0] on an empty string is undefined behavior. Add an empty check before the relative URL merge logic.
This commit is contained in:
@@ -170,7 +170,7 @@ void HttpRequestUpdate::update_task(void *params) {
|
||||
}
|
||||
|
||||
// Merge source_url_ and firmware_url
|
||||
if (info->firmware_url.find("http") == std::string::npos) {
|
||||
if (!info->firmware_url.empty() && info->firmware_url.find("http") == std::string::npos) {
|
||||
std::string path = info->firmware_url;
|
||||
if (path[0] == '/') {
|
||||
std::string domain = this_update->source_url_.substr(0, this_update->source_url_.find('/', 8));
|
||||
|
||||
Reference in New Issue
Block a user