Browser: Don't assume downloads have a "total size" available

Ran into a crash here while testing LibProtocol changes. The method we
invoke here (did_progress) already accepts an Optional, and handles when
that Optional is empty. So there's no need to assume `total_size` is
non-empty.
This commit is contained in:
Timothy Flynn 2024-05-24 11:43:39 -04:00 committed by Andreas Kling
parent 6056428cb5
commit b6f824a313

View file

@ -43,8 +43,9 @@ DownloadWidget::DownloadWidget(const URL::URL& url)
m_elapsed_timer.start();
m_download = Web::ResourceLoader::the().connector().start_request("GET", url);
VERIFY(m_download);
m_download->on_progress = [this](Optional<u64> total_size, u64 downloaded_size) {
did_progress(total_size.value(), downloaded_size);
did_progress(move(total_size), downloaded_size);
};
{