aboutsummaryrefslogtreecommitdiff
path: root/src/qt_common
diff options
context:
space:
mode:
authorJonas <104419015+jojo-chaechae@users.noreply.github.com>2026-11-03 05:26:36 +0600
committerGitHub <noreply@github.com>2026-11-03 05:26:36 +0600
commit0322a7a8b8cb86f23643827b0ac50fb938e9986f (patch)
tree04031f4156bc0cc01d10fbeab5f35c0debf0e0f3 /src/qt_common
parentd75018d5e18dc9632d0a528d039a323a86b33a62 (diff)
parente64268269f4f91e47087fc86de4d34ec84970992 (diff)
Merge pull request #320 from FranzQDH/fix-shortcut-null-loader
Prevents crashes when creating game shortcuts by validating the loade…
Diffstat (limited to 'src/qt_common')
-rw-r--r--src/qt_common/util/game.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/qt_common/util/game.cpp b/src/qt_common/util/game.cpp
index ddbe979765..ba669c3acf 100644
--- a/src/qt_common/util/game.cpp
+++ b/src/qt_common/util/game.cpp
@@ -430,8 +430,10 @@ void CreateShortcut(const std::string& game_path, const u64 program_id,
game_title = fmt::format("{:016X}", program_id);
if (control.first != nullptr) {
game_title = control.first->GetApplicationName();
- } else {
+ } else if (loader != nullptr) {
loader->ReadTitle(game_title);
+ } else {
+ LOG_WARNING(Frontend, "Could not load game title from {:s}", game_path);
}
}
@@ -448,7 +450,8 @@ void CreateShortcut(const std::string& game_path, const u64 program_id,
std::vector<u8> icon_image_file{};
if (control.second != nullptr) {
icon_image_file = control.second->ReadAllBytes();
- } else if (loader->ReadIcon(icon_image_file) != Loader::ResultStatus::Success) {
+ } else if (loader == nullptr ||
+ loader->ReadIcon(icon_image_file) != Loader::ResultStatus::Success) {
LOG_WARNING(Frontend, "Could not read icon from {:s}", game_path);
}
@@ -535,6 +538,10 @@ void CreateHomeMenuShortcut(ShortcutTarget target) {
}
bool SaveIconToFile(const std::filesystem::path& icon_path, const QImage& image) {
+ if (image.isNull()) {
+ return false;
+ }
+
#if defined(WIN32)
#pragma pack(push, 2)
struct IconDir {