Commit 642b1b82 authored by Patrick José Pereira's avatar Patrick José Pereira

MAVLinkLogManager: Remove pointer check before delete

Signed-off-by: 's avatarPatrick José Pereira <patrickelectric@gmail.com>
parent b4e20b3c
...@@ -688,9 +688,8 @@ MAVLinkLogManager::_sendLog(const QString& logFile) ...@@ -688,9 +688,8 @@ MAVLinkLogManager::_sendLog(const QString& logFile)
} }
QFile* file = new QFile(logFile); QFile* file = new QFile(logFile);
if(!file || !file->open(QIODevice::ReadOnly)) { if(!file || !file->open(QIODevice::ReadOnly)) {
if(file) { delete file;
delete file; file = nullptr;
}
qCWarning(MAVLinkLogManagerLog) << "Could not open log file:" << logFile; qCWarning(MAVLinkLogManagerLog) << "Could not open log file:" << logFile;
return false; return false;
} }
...@@ -929,10 +928,7 @@ MAVLinkLogManager::_discardLog() ...@@ -929,10 +928,7 @@ MAVLinkLogManager::_discardLog()
bool bool
MAVLinkLogManager::_createNewLog() MAVLinkLogManager::_createNewLog()
{ {
if(_logProcessor) { delete _logProcessor;
delete _logProcessor;
_logProcessor = nullptr;
}
_logProcessor = new MAVLinkLogProcessor; _logProcessor = new MAVLinkLogProcessor;
if(_logProcessor->create(this, _logPath, static_cast<uint8_t>(_vehicle->id()))) { if(_logProcessor->create(this, _logPath, static_cast<uint8_t>(_vehicle->id()))) {
_insertNewLog(_logProcessor->record()); _insertNewLog(_logProcessor->record());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment