From 40d9edd7a811e54d980bddad3329921157a0e15f Mon Sep 17 00:00:00 2001 From: ArsenArsen Date: Tue, 13 Jun 2017 17:02:35 +0200 Subject: [PATCH] Make sure we don't upload empty images --- recording/recordingformats.cpp | 2 +- uploaders/uploadersingleton.cpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/recording/recordingformats.cpp b/recording/recordingformats.cpp index 2eceeb3..d38aeeb 100644 --- a/recording/recordingformats.cpp +++ b/recording/recordingformats.cpp @@ -31,7 +31,7 @@ RecordingFormats::RecordingFormats(formats::Recording f) { delete enc; if (interrupt) { tmpDir.removeRecursively(); - return; + return QByteArray(); } QFile res(path); if (!res.open(QFile::ReadOnly)) { diff --git a/uploaders/uploadersingleton.cpp b/uploaders/uploadersingleton.cpp index 3aad18d..a1591e5 100644 --- a/uploaders/uploadersingleton.cpp +++ b/uploaders/uploadersingleton.cpp @@ -73,6 +73,7 @@ void UploaderSingleton::upload(QPixmap *pixmap) { } void UploaderSingleton::upload(QByteArray img, QString format) { + if (img.isEmpty()) return; QFile file(saveDir.absoluteFilePath(formatter::format(settings::settings().value("fileFormat").toString(), format.toLower()))); if (file.open(QFile::WriteOnly)) { file.write(img);