[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:
J. Nick Koston
2026-03-17 18:34:24 -10:00
parent 564128127b
commit 17476934c8
@@ -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));