fix: Intel Hex and Motorola SREC providers always being at least 1 byte long

This commit is contained in:
WerWolv
2025-07-20 00:46:20 +02:00
parent 5df50ef380
commit 17ab429a8c
2 changed files with 12 additions and 4 deletions

View File

@@ -207,7 +207,7 @@ namespace hex::plugin::builtin {
return false;
}
u64 maxAddress = 0x00;
std::optional<u64> 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;

View File

@@ -184,7 +184,7 @@ namespace hex::plugin::builtin {
return false;
}
u64 maxAddress = 0x00;
std::optional<u64> 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;