From bf230a99096bdd8b09ce8628c7db93715c2ba25f Mon Sep 17 00:00:00 2001 From: LillyJadeKatrin Date: Thu, 20 Jun 2024 23:15:19 -0400 Subject: [PATCH] Trim extra characters from measured progress The measured_progress C string for achievements to display potentially contains junk data after the null terminator, which was rendering in the QString in the dialog. This trims those junk characters. --- Source/Core/DolphinQt/Achievements/AchievementBox.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Source/Core/DolphinQt/Achievements/AchievementBox.cpp b/Source/Core/DolphinQt/Achievements/AchievementBox.cpp index a14936171d..c0fc202a8f 100644 --- a/Source/Core/DolphinQt/Achievements/AchievementBox.cpp +++ b/Source/Core/DolphinQt/Achievements/AchievementBox.cpp @@ -4,6 +4,7 @@ #ifdef USE_RETRO_ACHIEVEMENTS #include "DolphinQt/Achievements/AchievementBox.h" +#include #include #include #include @@ -92,7 +93,9 @@ void AchievementBox::UpdateData() m_progress_bar->setRange(0, 100); m_progress_bar->setValue(m_achievement->measured_percent); m_progress_bar->setTextVisible(false); - m_progress_label->setText(QString::fromUtf8(m_achievement->measured_progress, PROGRESS_LENGTH)); + m_progress_label->setText( + QString::fromUtf8(m_achievement->measured_progress, + qstrnlen(m_achievement->measured_progress, PROGRESS_LENGTH))); m_progress_bar->setVisible(true); } else