chore: add safety checks to RepositionTrafficLights (#21981)

This commit is contained in:
Samuel Attard 2020-01-31 10:27:25 -08:00 committed by GitHub
parent 45f30ead61
commit cabe514431
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -523,6 +523,12 @@ void NativeWindowMac::RepositionTrafficLights() {
NSButton* miniaturize = NSButton* miniaturize =
[window standardWindowButton:NSWindowMiniaturizeButton]; [window standardWindowButton:NSWindowMiniaturizeButton];
NSButton* zoom = [window standardWindowButton:NSWindowZoomButton]; NSButton* zoom = [window standardWindowButton:NSWindowZoomButton];
// Safety check just in case apple changes the view structure in a macOS
// update
DCHECK(close.superview);
DCHECK(close.superview.superview);
if (!close.superview || !close.superview.superview)
return;
NSView* titleBarContainerView = close.superview.superview; NSView* titleBarContainerView = close.superview.superview;
// Hide the container when exiting fullscreen, otherwise traffic light buttons // Hide the container when exiting fullscreen, otherwise traffic light buttons