summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2014-11-06 02:58:14 -0800
committerKonstantin Käfer <mail@kkaefer.com>2014-11-06 13:05:52 +0100
commit3303db79d925d7e712ed16378158d914f1c78293 (patch)
tree52f77fdf5deb1ecfe569b44489bec05e7290c7ce /platform
parent2e38b5964c4048072daa805a75ad564df5d9f9c5 (diff)
downloadqtlocation-mapboxgl-3303db79d925d7e712ed16378158d914f1c78293.tar.gz
fix undefined value
[skip ci]
Diffstat (limited to 'platform')
-rw-r--r--platform/default/http_request_baton_curl.cpp14
1 files changed, 5 insertions, 9 deletions
diff --git a/platform/default/http_request_baton_curl.cpp b/platform/default/http_request_baton_curl.cpp
index 986191ef80..ecde8618fd 100644
--- a/platform/default/http_request_baton_curl.cpp
+++ b/platform/default/http_request_baton_curl.cpp
@@ -245,13 +245,9 @@ void curl_perform(uv_poll_t *req, int /* status */, int events) {
}
int handle_socket(CURL * /* handle */, curl_socket_t s, int action, void * /* userp */, void *socketp) {
- Socket *socket;
- if (action == CURL_POLL_IN || action == CURL_POLL_OUT) {
- if (socketp) {
- socket = (Socket *)socketp;
- } else {
- socket = new Socket(s);
- }
+ Socket *socket = (Socket *)socketp;
+ if (!socket && action != CURL_POLL_REMOVE) {
+ socket = new Socket(s);
curl_multi_assign(multi, s, (void *)socket);
}
@@ -263,8 +259,8 @@ int handle_socket(CURL * /* handle */, curl_socket_t s, int action, void * /* us
socket->start(UV_WRITABLE, curl_perform);
break;
case CURL_POLL_REMOVE:
- if (socketp) {
- ((Socket *)socketp)->stop();
+ if (socket) {
+ socket->stop();
curl_multi_assign(multi, s, NULL);
}
break;