UI: fix crash with HUD panel size

There can be no panels in the region.
This commit is contained in:
Campbell Barton 2018-06-12 11:18:52 +02:00
parent 6d152c5997
commit d2e691b91a
1 changed files with 13 additions and 11 deletions

View File

@ -2061,17 +2061,19 @@ void ED_region_panels_layout_ex(
* Can't use x/y values calculated above because they're not using the real height of panels,
* instead they calculate offsets for the next panel to start drawing. */
Panel *panel = ar->panels.last;
int size_dyn[2] = {
UI_UNIT_X * 12,
UI_panel_size_y(panel),
};
/* region size is layout based and needs to be updated */
if ((ar->sizex != size_dyn[0]) ||
(ar->sizey != size_dyn[1]))
{
ar->sizex = size_dyn[0];
ar->sizey = size_dyn[1];
sa->flag |= AREA_FLAG_REGION_SIZE_UPDATE;
if (panel != NULL) {
int size_dyn[2] = {
UI_UNIT_X * 12,
UI_panel_size_y(panel),
};
/* region size is layout based and needs to be updated */
if ((ar->sizex != size_dyn[0]) ||
(ar->sizey != size_dyn[1]))
{
ar->sizex = size_dyn[0];
ar->sizey = size_dyn[1];
sa->flag |= AREA_FLAG_REGION_SIZE_UPDATE;
}
}
}
else if (vertical) {