Debugger: Fix crash in Inspector.
- If a selection was active, and the hex mode was switched to not display, a divide by zero crash would occur. Spotted by Olivier Coursiere.
This commit is contained in:
@@ -683,6 +683,9 @@ BPoint
|
|||||||
MemoryView::_GetPointForOffset(int32 offset) const
|
MemoryView::_GetPointForOffset(int32 offset) const
|
||||||
{
|
{
|
||||||
BPoint point;
|
BPoint point;
|
||||||
|
if (fHexMode == HexModeNone)
|
||||||
|
return point;
|
||||||
|
|
||||||
int32 bytesPerLine = fHexBlocksPerLine * _GetHexDigitsPerBlock() / 2;
|
int32 bytesPerLine = fHexBlocksPerLine * _GetHexDigitsPerBlock() / 2;
|
||||||
int32 line = offset / bytesPerLine;
|
int32 line = offset / bytesPerLine;
|
||||||
int32 lineOffset = offset % bytesPerLine;
|
int32 lineOffset = offset % bytesPerLine;
|
||||||
@@ -742,6 +745,9 @@ MemoryView::_GetAddressDisplayWidth() const
|
|||||||
void
|
void
|
||||||
MemoryView::_GetSelectionRegion(BRegion& region)
|
MemoryView::_GetSelectionRegion(BRegion& region)
|
||||||
{
|
{
|
||||||
|
if (fHexMode == HexModeNone)
|
||||||
|
return;
|
||||||
|
|
||||||
region.MakeEmpty();
|
region.MakeEmpty();
|
||||||
BPoint startPoint = _GetPointForOffset(fSelectionStart);
|
BPoint startPoint = _GetPointForOffset(fSelectionStart);
|
||||||
BPoint endPoint = _GetPointForOffset(fSelectionEnd);
|
BPoint endPoint = _GetPointForOffset(fSelectionEnd);
|
||||||
|
|||||||
Reference in New Issue
Block a user