浏览代码

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.
Timothy Flynn 1 年之前
父节点
当前提交
b6f824a313
共有 1 个文件被更改,包括 2 次插入1 次删除
  1. 2 1
      Userland/Applications/Browser/DownloadWidget.cpp

+ 2 - 1
Userland/Applications/Browser/DownloadWidget.cpp

@@ -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);
     };
 
     {