From f1331c4bdec570823493d49133b0953d5e427cad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gheorghi=C8=9B=C4=83=20Mutu?= Date: Sat, 17 Aug 2024 09:47:03 +0300 Subject: [PATCH] [LNK] # add default value on unknown extra data signature type #335 --- Types/LNK/include/Internal.hpp | 9 +++++++++ Types/LNK/src/LNK.cpp | 2 +- Types/LNK/src/Panels/ExtraData.cpp | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Types/LNK/include/Internal.hpp b/Types/LNK/include/Internal.hpp index 065cf1e8..f556abe1 100644 --- a/Types/LNK/include/Internal.hpp +++ b/Types/LNK/include/Internal.hpp @@ -1818,4 +1818,13 @@ static std::string_view GetNameFromGUID(const MyGUID& guid) return "Unknown"; } + +static std::string_view GetExtraDataSignaturesName(ExtraDataSignatures type) { + if (LNK::ExtraDataSignaturesNames.contains(type)) { + return LNK::ExtraDataSignaturesNames.at(type); + } + + return "?Signature"; +} + } // namespace GView::Type::LNK diff --git a/Types/LNK/src/LNK.cpp b/Types/LNK/src/LNK.cpp index da7c0ba4..176419ef 100644 --- a/Types/LNK/src/LNK.cpp +++ b/Types/LNK/src/LNK.cpp @@ -92,7 +92,7 @@ extern "C" for (const auto& extraData : lnk->extraDataBases) { - const auto& name = LNK::ExtraDataSignaturesNames.at(extraData->signature); + const auto& name = LNK::GetExtraDataSignaturesName(extraData->signature); const auto& c = *(colors.begin() + (count % 2)); settings.AddZone(offset, extraData->size, c, name.data()); count++; diff --git a/Types/LNK/src/Panels/ExtraData.cpp b/Types/LNK/src/Panels/ExtraData.cpp index ef906334..51754c4f 100644 --- a/Types/LNK/src/Panels/ExtraData.cpp +++ b/Types/LNK/src/Panels/ExtraData.cpp @@ -66,7 +66,7 @@ void ExtraData::UpdateGeneralInformation() void ExtraData::UpdateExtraDataBase(ExtraDataBase* base) { - const auto& signatureName = LNK::ExtraDataSignaturesNames.at(base->signature).data(); + const auto& signatureName = LNK::GetExtraDataSignaturesName(base->signature).data(); general->AddItem(signatureName).SetType(ListViewItem::Type::Category);