mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-11-15 02:11:22 +00:00
Add extra protection against invalid buffers in buffer viewer
This commit is contained in:
1 file changed
+8
-2
@@ -2673,8 +2673,14 @@ void BufferViewer::OnEventChanged(uint32_t eventId)
|
||||
rangeEnd = UINT64_MAX;
|
||||
|
||||
// get the underlying buffer length
|
||||
uint64_t bufferLength =
|
||||
m_IsBuffer && m_BufferID != ResourceId() ? m_Ctx.GetBuffer(m_BufferID)->length : 0;
|
||||
uint64_t bufferLength = 0;
|
||||
|
||||
if(m_IsBuffer && m_BufferID != ResourceId())
|
||||
{
|
||||
const BufferDescription *desc = m_Ctx.GetBuffer(m_BufferID);
|
||||
if(desc)
|
||||
bufferLength = desc->length;
|
||||
}
|
||||
|
||||
// clamp the range to the buffer length, which may end up with it being empty
|
||||
rangeEnd = qMin(rangeEnd, bufferLength);
|
||||
|
||||
Reference in new issue
Block a user