fix: Crash when hex editor visualizer size is not divisible by row count

This commit is contained in:
WerWolv
2022-09-28 18:29:56 +02:00
parent d3f83e63c9
commit 8bd31f6375

View File

@@ -803,7 +803,7 @@ namespace hex::plugin::builtin {
std::vector<std::tuple<std::optional<color_t>, std::optional<color_t>>> cellColors;
{
for (u64 x = 0; x < columnCount; x++) {
for (u64 x = 0; x < std::ceil(float(validBytes) / bytesPerCell); x++) {
const u64 byteAddress = y * this->m_bytesPerRow + x * bytesPerCell + provider->getBaseAddress() + provider->getCurrentPageAddress();
const auto cellBytes = std::min<u64>(validBytes, bytesPerCell);