Bug 1442938: Nil-check the title in nsCocoaWindow::importState / exportState. r=mstange

Looking at the docs for [NSWindow title] I don't think it's supposed to return
nil under any circumstances...

But it does in our automation, for some reason, with the patches for bug 1439875
which make our fullscreen code run a bit earlier.

MozReview-Commit-ID: AX4qzjzsqST

--HG--
extra : rebase_source : a01f2ba6b42b4067e7a4886c4814e85f317a4a6f
This commit is contained in:
Emilio Cobos Álvarez 2018-03-03 18:47:41 +01:00
Родитель 8f461abbfb
Коммит b7cf65fe60
1 изменённых файлов: 6 добавлений и 2 удалений

Просмотреть файл

@ -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];