TAStudio: Prevent exceptions with small window size
This commit is contained in:
parent
41d1db14ef
commit
c5407472cd
|
@ -140,6 +140,11 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
private void DrawData(PaintEventArgs e, List<RollColumn> visibleColumns)
|
private void DrawData(PaintEventArgs e, List<RollColumn> visibleColumns)
|
||||||
{
|
{
|
||||||
|
// Prevent exceptions with small TAStudio windows
|
||||||
|
if (visibleColumns.Count == 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (QueryItemText != null)
|
if (QueryItemText != null)
|
||||||
{
|
{
|
||||||
if (HorizontalOrientation)
|
if (HorizontalOrientation)
|
||||||
|
@ -532,6 +537,11 @@ namespace BizHawk.Client.EmuHawk
|
||||||
int range = Math.Min(LastVisibleRow, RowCount - 1) - startIndex + 1;
|
int range = Math.Min(LastVisibleRow, RowCount - 1) - startIndex + 1;
|
||||||
int lastVisible = LastVisibleColumnIndex;
|
int lastVisible = LastVisibleColumnIndex;
|
||||||
int firstVisibleColumn = FirstVisibleColumn;
|
int firstVisibleColumn = FirstVisibleColumn;
|
||||||
|
// Prevent exceptions with small TAStudio windows
|
||||||
|
if (firstVisibleColumn < 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (HorizontalOrientation)
|
if (HorizontalOrientation)
|
||||||
{
|
{
|
||||||
for (int i = 0, f = 0; f < range; i++, f++)
|
for (int i = 0, f = 0; f < range; i++, f++)
|
||||||
|
|
|
@ -1608,7 +1608,9 @@ namespace BizHawk.Client.EmuHawk
|
||||||
{
|
{
|
||||||
_vBar.Maximum = Math.Max((VisibleRows - 1) * CellHeight, _vBar.Maximum); // ScrollBar.Maximum is dumb
|
_vBar.Maximum = Math.Max((VisibleRows - 1) * CellHeight, _vBar.Maximum); // ScrollBar.Maximum is dumb
|
||||||
_vBar.LargeChange = (VisibleRows - 1) * CellHeight;
|
_vBar.LargeChange = (VisibleRows - 1) * CellHeight;
|
||||||
_hBar.LargeChange = DrawWidth / 2;
|
// DrawWidth can be negative if the TAStudio window is small enough
|
||||||
|
// Clamp LargeChange to 0 here to prevent exceptions
|
||||||
|
_hBar.LargeChange = Math.Max(0, DrawWidth / 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue