summaryrefslogtreecommitdiff
path: root/Userland/pro.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-04-04 20:00:07 +0200
committerAndreas Kling <kling@serenityos.org>2020-04-04 20:01:36 +0200
commitfc5067afd287b951b07b00e39126562164f29207 (patch)
tree8a40357fe7a973e10e87fdf7c4236acbec59765c /Userland/pro.cpp
parent53d0ca2ad8ad8ee1094da9ec1152e6b1cf7fb321 (diff)
downloadserenity-fc5067afd287b951b07b00e39126562164f29207.zip
ProtocolServer+LibProtocol: Reject unhandled URLs instead of asserting
StartDownload requests for unhandled protocols (or invalid URLs) will now refuse to load instead of asserting. A failure code is sent back to LibProtocol and Protocol::Client::start_download() returns nullptr. Fixes #1604.
Diffstat (limited to 'Userland/pro.cpp')
-rw-r--r--Userland/pro.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/Userland/pro.cpp b/Userland/pro.cpp
index 788e42427f..51d0b4912f 100644
--- a/Userland/pro.cpp
+++ b/Userland/pro.cpp
@@ -49,6 +49,10 @@ int main(int argc, char** argv)
auto protocol_client = Protocol::Client::construct();
auto download = protocol_client->start_download(url.to_string());
+ if (!download) {
+ fprintf(stderr, "Failed to start download for '%s'\n", url_string.characters());
+ return 1;
+ }
download->on_progress = [](u32 total_size, u32 downloaded_size) {
dbgprintf("download progress: %u / %u\n", downloaded_size, total_size);
};