Skip to content

Commit 5bf2205

Browse files
committed
address analysis warning
1 parent 76a32fa commit 5bf2205

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

src/ui/viewmodels/MemoryViewerViewModel.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1160,11 +1160,15 @@ void MemoryViewerViewModel::DoFrame()
11601160

11611161
const auto& pMemoryContext = ra::services::ServiceLocator::Get<ra::context::IEmulatorMemoryContext>();
11621162
const auto nToRead = gsl::narrow_cast<size_t>(nVisibleLines) * 16;
1163-
const auto nRead = m_pInvalid[0] ? 0 : pMemoryContext.ReadMemory(nAddress, pMemory, nToRead);
1164-
for (auto nOffset = nRead; nOffset < nToRead; nOffset += 16)
1163+
if (m_pInvalid[0] || pMemoryContext.ReadMemory(nAddress, pMemory, nToRead) != nToRead)
11651164
{
1166-
if (!m_pInvalid[nOffset])
1167-
pMemoryContext.ReadMemory(nAddress + nOffset, &pMemory[nOffset], 16);
1165+
memset(&pMemory, 0, sizeof(pMemory));
1166+
1167+
for (auto nOffset = 0; nOffset < nToRead; nOffset += 16)
1168+
{
1169+
if (!m_pInvalid[nOffset])
1170+
pMemoryContext.ReadMemory(nAddress + nOffset, &pMemory[nOffset], 16);
1171+
}
11681172
}
11691173

11701174
constexpr int nStride = 8;

0 commit comments

Comments
 (0)