mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2025-09-03 13:47:51 -04:00
Prevent some possible segfault errors (patch by Mike W9MDB).
This commit is contained in:
parent
bc8ee62900
commit
0cd2935b8c
@ -444,8 +444,12 @@ QString DXLabSuiteCommanderTransceiver::command_with_reply (QString const& cmd)
|
|||||||
// qDebug () << i << ":" << hex << int (result[i]);
|
// qDebug () << i << ":" << hex << int (result[i]);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
if (result != NULL)
|
||||||
|
{
|
||||||
CAT_TRACE (cmd << " -> " << QString {result});
|
CAT_TRACE (cmd << " -> " << QString {result});
|
||||||
return result; // converting raw UTF-8 bytes to QString
|
return result; // converting raw UTF-8 bytes to QString
|
||||||
|
}
|
||||||
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DXLabSuiteCommanderTransceiver::write_to_port (QString const& s)
|
bool DXLabSuiteCommanderTransceiver::write_to_port (QString const& s)
|
||||||
|
@ -90,6 +90,7 @@
|
|||||||
#include "ExportCabrillo.h"
|
#include "ExportCabrillo.h"
|
||||||
#include "ui_mainwindow.h"
|
#include "ui_mainwindow.h"
|
||||||
#include "moc_mainwindow.cpp"
|
#include "moc_mainwindow.cpp"
|
||||||
|
#include "Logger.hpp"
|
||||||
|
|
||||||
#define FCL fortran_charlen_t
|
#define FCL fortran_charlen_t
|
||||||
|
|
||||||
@ -1385,7 +1386,9 @@ void MainWindow::set_application_font (QFont const& font)
|
|||||||
QFile sf {sheet};
|
QFile sf {sheet};
|
||||||
if (sf.open (QFile::ReadOnly | QFile::Text))
|
if (sf.open (QFile::ReadOnly | QFile::Text))
|
||||||
{
|
{
|
||||||
ss = sf.readAll () + ss;
|
QString tmp = sf.readAll();
|
||||||
|
if (tmp != NULL) ss = sf.readAll () + tmp;
|
||||||
|
else qDebug() << "tmp==NULL at sf.readAll";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
qApp->setStyleSheet (ss + "* {" + font_as_stylesheet (font) + '}');
|
qApp->setStyleSheet (ss + "* {" + font_as_stylesheet (font) + '}');
|
||||||
@ -4023,7 +4026,8 @@ void MainWindow::readFromStdout() //readFromStdout
|
|||||||
if(f.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
if(f.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||||
QTextStream s(&f);
|
QTextStream s(&f);
|
||||||
QString t=s.readAll();
|
QString t=s.readAll();
|
||||||
m_msgAvgWidget->displayAvg(t);
|
if (t != NULL) m_msgAvgWidget->displayAvg(t);
|
||||||
|
else qDebug() << "tmp==NULL at s.readAll";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -6152,7 +6156,9 @@ void MainWindow::on_addButton_clicked() //Add button
|
|||||||
// preserve symlinks
|
// preserve symlinks
|
||||||
f1.open (QFile::WriteOnly | QFile::Text); // truncates
|
f1.open (QFile::WriteOnly | QFile::Text); // truncates
|
||||||
f2.seek (0);
|
f2.seek (0);
|
||||||
f1.write (f2.readAll ()); // copy contents
|
QByteArray tmp = f2.readAll();
|
||||||
|
if (tmp != (const char*)NULL) f1.write (tmp); // copy contents
|
||||||
|
else qDebug() << "tmp==NULL at f1.write";
|
||||||
f2.remove ();
|
f2.remove ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user