diff --git a/widget/cocoa/nsCocoaWindow.mm b/widget/cocoa/nsCocoaWindow.mm index 2b44bf2bc983..1f1ae508acb5 100644 --- a/widget/cocoa/nsCocoaWindow.mm +++ b/widget/cocoa/nsCocoaWindow.mm @@ -3198,7 +3198,9 @@ static const NSString* kStateCollectionBehavior = @"collectionBehavior"; - (void)importState:(NSDictionary*)aState { - [self setTitle:[aState objectForKey:kStateTitleKey]]; + if (NSString* title = [aState objectForKey:kStateTitleKey]) { + [self setTitle:title]; + } [self setDrawsContentsIntoWindowFrame:[[aState objectForKey:kStateDrawsContentsIntoWindowFrameKey] boolValue]]; [self setTitlebarColor:[aState objectForKey:kStateActiveTitlebarColorKey] forActiveWindow:YES]; [self setTitlebarColor:[aState objectForKey:kStateInactiveTitlebarColorKey] forActiveWindow:NO]; @@ -3209,7 +3211,9 @@ static const NSString* kStateCollectionBehavior = @"collectionBehavior"; - (NSMutableDictionary*)exportState { NSMutableDictionary* state = [NSMutableDictionary dictionaryWithCapacity:10]; - [state setObject:[self title] forKey:kStateTitleKey]; + if (NSString* title = [self title]) { + [state setObject:title forKey:kStateTitleKey]; + } [state setObject:[NSNumber numberWithBool:[self drawsContentsIntoWindowFrame]] forKey:kStateDrawsContentsIntoWindowFrameKey]; NSColor* activeTitlebarColor = [self titlebarColorForActiveWindow:YES];