mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-03-28 07:47:03 -05:00
fix: Intel Hex and Motorola SREC providers always being at least 1 byte long
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user