aboutsummaryrefslogtreecommitdiff
path: root/launcher/ui/MainWindow.cpp
diff options
context:
space:
mode:
authorADudeCalledLeo <7997354+Leo40Git@users.noreply.github.com>2022-11-13 20:18:51 +0200
committerADudeCalledLeo <7997354+Leo40Git@users.noreply.github.com>2022-11-13 20:18:51 +0200
commit5be8545edcf53cd410d0ea14168b5675150106fc (patch)
treee10057aac56ed84bef0c27b630fd4e98344ea989 /launcher/ui/MainWindow.cpp
parentacd50969e0fcb172cf5f62e5ced4d10c6a9cbbe6 (diff)
downloadPrismLauncher-5be8545edcf53cd410d0ea14168b5675150106fc.tar.gz
PrismLauncher-5be8545edcf53cd410d0ea14168b5675150106fc.tar.bz2
PrismLauncher-5be8545edcf53cd410d0ea14168b5675150106fc.zip
Windows, Linux: prevent segfault on missing icon
Signed-off-by: ADudeCalledLeo <7997354+Leo40Git@users.noreply.github.com>
Diffstat (limited to 'launcher/ui/MainWindow.cpp')
-rw-r--r--launcher/ui/MainWindow.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/launcher/ui/MainWindow.cpp b/launcher/ui/MainWindow.cpp
index 4dbac967..4e6ce82c 100644
--- a/launcher/ui/MainWindow.cpp
+++ b/launcher/ui/MainWindow.cpp
@@ -2131,7 +2131,11 @@ void MainWindow::on_actionCreateInstanceShortcut_triggered()
}
auto icon = APPLICATION->icons()->icon(m_selectedInstance->iconKey());
-
+ if (icon == nullptr)
+ {
+ icon = APPLICATION->icons()->icon("grass");
+ }
+
QString iconPath = FS::PathCombine(m_selectedInstance->instanceRoot(), "icon.png");
QFile iconFile(iconPath);
@@ -2162,7 +2166,11 @@ void MainWindow::on_actionCreateInstanceShortcut_triggered()
}
#elif defined(Q_OS_WIN)
auto icon = APPLICATION->icons()->icon(m_selectedInstance->iconKey());
-
+ if (icon == nullptr)
+ {
+ icon = APPLICATION->icons()->icon("grass");
+ }
+
QString iconPath = FS::PathCombine(m_selectedInstance->instanceRoot(), "icon.ico");
// part of fix for weird bug involving the window icon being replaced