From 173fe34355cd3cdb4607faeb1587a53663517f2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fauconnier?= Date: Fri, 4 Mar 2022 15:23:29 +0100 Subject: [PATCH] prevent a crash when trying to open an ubx file by double click or 'open with' actions --- src/core/UBApplication.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/core/UBApplication.cpp b/src/core/UBApplication.cpp index b5cdfcc4..d1ef381c 100644 --- a/src/core/UBApplication.cpp +++ b/src/core/UBApplication.cpp @@ -347,7 +347,7 @@ int UBApplication::exec(const QString& pFileToImport) applicationController->initScreenLayout(bUseMultiScreen); boardController->setupLayout(); - if (pFileToImport.length() > 0) + if (pFileToImport.length() > 0 && !pFileToImport.endsWith("ubx")) UBApplication::applicationController->importFile(pFileToImport); if (UBSettings::settings()->appStartMode->get().toInt()) @@ -575,7 +575,10 @@ bool UBApplication::eventFilter(QObject *obj, QEvent *event) UBPlatformUtils::setFrontProcess(); - applicationController->importFile(fileToOpenEvent->file()); + if (!fileToOpenEvent->file().endsWith("ubx")) + applicationController->importFile(fileToOpenEvent->file()); + else + applicationController->showMessage(tr("Cannot open your UBX file directly. Please import it in Documents mode instead"), false); } if (event->type() == QEvent::TabletLeaveProximity)