Procházet zdrojové kódy

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 před 1 rokem
rodič
revize
b6f824a313
1 změnil soubory, kde provedl 2 přidání a 1 odebrání
  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_elapsed_timer.start();
     m_download = Web::ResourceLoader::the().connector().start_request("GET", url);
     m_download = Web::ResourceLoader::the().connector().start_request("GET", url);
     VERIFY(m_download);
     VERIFY(m_download);
+
     m_download->on_progress = [this](Optional<u64> total_size, u64 downloaded_size) {
     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);
     };
     };
 
 
     {
     {