From: Konrad Rosenbaum Date: Wed, 21 Dec 2016 22:56:44 +0000 (+0100) Subject: fix crash X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=94e8ce7551a01c71a0cbe0f041a85c89db52a06c;p=web%2Fkonrad%2Fsmoke.git fix crash Change-Id: I83d64f1b0071517d06d2b24e8a6c0ef48a720435 --- diff --git a/commonlib/misc/debug.cpp b/commonlib/misc/debug.cpp index afab33f..53cec50 100644 --- a/commonlib/misc/debug.cpp +++ b/commonlib/misc/debug.cpp @@ -25,9 +25,11 @@ static QFile*mylogFile=0; static void mymsghandler(QtMsgType,const QMessageLogContext&, const QString&msg) { if(mylogFile){ - QByteArray data= - QDateTime::currentDateTime().toString("yyyy-MM-dd hh.mm.ss.zzz").toLatin1() +" "+ - msg.toLatin1()+"\n"; + QByteArray data; + //QDateTime::toString requires an active app object, otherwise it crashes + if(qApp) + data=QDateTime::currentDateTime().toString("yyyy-MM-dd hh.mm.ss.zzz").toLatin1() +" "; + data+=msg.toLatin1()+"\n"; mylogFile->write(data); mylogFile->flush(); }