From 7341257fc4c8a8359975edf0dbb75e5e70719673 Mon Sep 17 00:00:00 2001 From: Godkratos Date: Mon, 18 May 2020 11:10:12 +1200 Subject: [PATCH] Validate uuid and fix returns --- src/yuzu/main.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 9a236eb9b8..62c1f91612 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -138,18 +138,21 @@ __declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1; namespace { QString GetAccountUsername() { + const QString nouser = QString::fromStdString("No User"); Service::Account::ProfileManager manager; const auto current_user = manager.GetUser(Settings::values.current_user); - ASSERT(current_user); + if (!current_user.has_value()) { + return nouser; + } Service::Account::ProfileBase profile; if (!manager.GetProfileBase(*current_user, profile)) { - return {}; + return nouser; } const auto text = Common::StringFromFixedZeroTerminatedBuffer( reinterpret_cast(profile.username.data()), profile.username.size()); - return QString::fromStdString(text.empty() ? "No User" : text); + return text.empty() ? nouser : QString::fromStdString(text); } } // Anonymous namespace