[Bf-blender-cvs] [d2e691b91ae] blender2.8: UI: fix crash with HUD panel size

Campbell Barton noreply at git.blender.org
Tue Jun 12 11:19:49 CEST 2018


Commit: d2e691b91ae337ddb5ee3f8e37b84daad00925bb
Author: Campbell Barton
Date:   Tue Jun 12 11:18:52 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBd2e691b91ae337ddb5ee3f8e37b84daad00925bb

UI: fix crash with HUD panel size

There can be no panels in the region.

===================================================================

M	source/blender/editors/screen/area.c

===================================================================

diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index 316b8cbe55f..d2301fa74d4 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -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) {



More information about the Bf-blender-cvs mailing list