From ab0f2d1a03c9ca45dd30440b8a897d9de480bfbe Mon Sep 17 00:00:00 2001 From: Alexander Tkachev Date: Wed, 20 Jul 2016 12:45:49 +0600 Subject: CLOUD: Fix OneDriveUploadRequest Segfault when given stream is nullptr. --- backends/cloud/onedrive/onedriveuploadrequest.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'backends/cloud') diff --git a/backends/cloud/onedrive/onedriveuploadrequest.cpp b/backends/cloud/onedrive/onedriveuploadrequest.cpp index 55359f83e7..5b86c6c988 100644 --- a/backends/cloud/onedrive/onedriveuploadrequest.cpp +++ b/backends/cloud/onedrive/onedriveuploadrequest.cpp @@ -50,9 +50,15 @@ OneDriveUploadRequest::~OneDriveUploadRequest() { void OneDriveUploadRequest::start() { _ignoreCallback = true; if (_workingRequest) _workingRequest->finish(); + if (_contentsStream == nullptr) { + warning("OneDriveUploadRequest: cannot restart because no stream given"); + finishError(Networking::ErrorResponse(this, false, true, "No stream given", -1)); + return; + } if (!_contentsStream->seek(0)) { warning("OneDriveUploadRequest: cannot restart because stream couldn't seek(0)"); finishError(Networking::ErrorResponse(this, false, true, "", -1)); + return; } _ignoreCallback = false; -- cgit v1.2.3