try only show MessageBoxes if that is possible

Change-Id: I70f41b7a2936d6797895559530050e8de54b2913
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Tim Jenssen
2019-07-17 12:35:25 +02:00
parent 191bb8d383
commit dfd9d5a5ee

View File

@@ -120,15 +120,15 @@ static inline QString toHtml(const QString &t)
static void displayHelpText(const QString &t) static void displayHelpText(const QString &t)
{ {
if (Utils::HostOsInfo::isWindowsHost()) if (Utils::HostOsInfo::isWindowsHost() && qApp)
QMessageBox::information(0, QLatin1String(Core::Constants::IDE_DISPLAY_NAME), toHtml(t)); QMessageBox::information(nullptr, QLatin1String(Core::Constants::IDE_DISPLAY_NAME), toHtml(t));
else else
qWarning("%s", qPrintable(t)); qWarning("%s", qPrintable(t));
} }
static void displayError(const QString &t) static void displayError(const QString &t)
{ {
if (Utils::HostOsInfo::isWindowsHost()) if (Utils::HostOsInfo::isWindowsHost() && qApp)
QMessageBox::critical(0, QLatin1String(Core::Constants::IDE_DISPLAY_NAME), t); QMessageBox::critical(0, QLatin1String(Core::Constants::IDE_DISPLAY_NAME), t);
else else
qCritical("%s", qPrintable(t)); qCritical("%s", qPrintable(t));