diff --git a/plugins/builtin/source/content/providers/intel_hex_provider.cpp b/plugins/builtin/source/content/providers/intel_hex_provider.cpp index 7ffa6796c..244968dec 100644 --- a/plugins/builtin/source/content/providers/intel_hex_provider.cpp +++ b/plugins/builtin/source/content/providers/intel_hex_provider.cpp @@ -207,7 +207,7 @@ namespace hex::plugin::builtin { return false; } - u64 maxAddress = 0x00; + std::optional maxAddress; for (auto &[address, bytes] : data.value()) { auto endAddress = (address + bytes.size()) - 1; m_data.emplace({ address, endAddress }, std::move(bytes)); @@ -216,7 +216,11 @@ namespace hex::plugin::builtin { maxAddress = endAddress; } - m_dataSize = maxAddress + 1; + if (maxAddress.has_value()) + m_dataSize = *maxAddress + 1; + else + m_dataSize = 0x00; + m_dataValid = true; return true; diff --git a/plugins/builtin/source/content/providers/motorola_srec_provider.cpp b/plugins/builtin/source/content/providers/motorola_srec_provider.cpp index 7009f52c9..ef9ccef20 100644 --- a/plugins/builtin/source/content/providers/motorola_srec_provider.cpp +++ b/plugins/builtin/source/content/providers/motorola_srec_provider.cpp @@ -184,7 +184,7 @@ namespace hex::plugin::builtin { return false; } - u64 maxAddress = 0x00; + std::optional maxAddress; for (auto &[address, bytes] : data.value()) { auto endAddress = (address + bytes.size()) - 1; m_data.emplace({ address, endAddress }, std::move(bytes)); @@ -193,7 +193,11 @@ namespace hex::plugin::builtin { maxAddress = endAddress; } - m_dataSize = maxAddress + 1; + if (maxAddress.has_value()) + m_dataSize = *maxAddress + 1; + else + m_dataSize = 0x00; + m_dataValid = true; return true;