diff options
author | Max Kellermann <max@musicpd.org> | 2017-01-08 13:51:03 +0100 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2017-01-08 13:51:53 +0100 |
commit | dc53098e43b95c08f80fa9b383e8e33f2d69e89e (patch) | |
tree | a81ca06e37402d18fdede5a48374fe6086148e4d /src/lib/curl/Request.cxx | |
parent | 3c66feff5ac2ea4641f52747d05125c320da3431 (diff) |
lib/curl/Request: allow Stop() to be called twice
Convert assertion to runtime check. This is useful because this is a
public method, and the caller has no chance to check if the object is
still registered.
Diffstat (limited to 'src/lib/curl/Request.cxx')
-rw-r--r-- | src/lib/curl/Request.cxx | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lib/curl/Request.cxx b/src/lib/curl/Request.cxx index 2af6ba881..84ea59b3b 100644 --- a/src/lib/curl/Request.cxx +++ b/src/lib/curl/Request.cxx @@ -81,7 +81,8 @@ CurlRequest::Start() void CurlRequest::Stop() { - assert(registered); + if (!registered) + return; global.Remove(easy.Get()); registered = false; @@ -93,8 +94,7 @@ CurlRequest::FreeEasy() if (!easy) return; - if (registered) - Stop(); + Stop(); easy = nullptr; } |