mirror of
https://github.com/SerenityOS/serenity
synced 2024-07-22 18:46:18 +00:00
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:
parent
6056428cb5
commit
b6f824a313
|
@ -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);
|
||||
};
|
||||
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue