Skip to content

Commit

Permalink
Merge pull request #507 from mxaddict/patch-19
Browse files Browse the repository at this point in the history
Fixed a bug with the errorLogFile causing crashes
  • Loading branch information
mxaddict committed Jun 5, 2019
2 parents c2855a7 + 5b5e756 commit 9f40cbd
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/qt/rpcconsole.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,8 @@ RPCConsole::RPCConsole(const PlatformStyle *platformStyle, QWidget *parent) :
platformStyle(platformStyle),
peersTableContextMenu(0),
banTableContextMenu(0),
consoleFontSize(0)
consoleFontSize(0),
errorLogFile(0)
{
ui->setupUi(this);
GUIUtil::restoreWindowGeometry("nRPCConsoleWindow", this->size(), this);
Expand Down Expand Up @@ -323,11 +324,16 @@ RPCConsole::~RPCConsole()
void RPCConsole::errorLogInitPos()
{
// Check if we already have the file
if (errorLogFile != NULL) {
if (errorLogFile == NULL) {
// Get a QFile instance
errorLogFile = new QFile(QString::fromStdString(GetErrorLogPath().string()));
}

// Check if we have a log file
// We can't tail a missing file
if (!errorLogFile->exists())
return;

// Try to open file
if (!errorLogFile->open(QFile::ReadOnly | QFile::Text))
return;
Expand Down Expand Up @@ -374,6 +380,11 @@ void RPCConsole::errorLogRefresh()
if (!errorLogInitPosDone)
errorLogInitPos();

// Check if log initialized
// We can't tail a missing file
if (!errorLogInitPosDone)
return;

// Load the stream
QTextStream in(errorLogFile);

Expand Down

0 comments on commit 9f40cbd

Please sign in to comment.