Skip to content

Commit

Permalink
Better fix for bug 3048, don't crash if the window title is NULL
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Jul 5, 2015
1 parent d0ba0c1 commit 396b3b8
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/video/cocoa/SDL_cocoawindow.m
Expand Up @@ -1241,8 +1241,9 @@ - (void)resetCursorRects
Cocoa_SetWindowTitle(_THIS, SDL_Window * window)
{ @autoreleasepool
{
const char *title = window->title ? window->title : "";
NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow;
NSString *string = [[NSString alloc] initWithUTF8String:window->title];
NSString *string = [[NSString alloc] initWithUTF8String:title];
[nswindow setTitle:string];
[string release];
}}
Expand Down Expand Up @@ -1428,7 +1429,7 @@ - (void)resetCursorRects
{ @autoreleasepool
{
if (SetWindowStyle(window, GetWindowStyle(window))) {
if (bordered && window->title) {
if (bordered) {
Cocoa_SetWindowTitle(_this, window); /* this got blanked out. */
}
}
Expand Down Expand Up @@ -1499,7 +1500,7 @@ - (void)resetCursorRects
s_moveHack = SDL_GetTicks();

/* When the window style changes the title is cleared */
if (!fullscreen && window->title) {
if (!fullscreen) {
Cocoa_SetWindowTitle(_this, window);
}

Expand Down

0 comments on commit 396b3b8

Please sign in to comment.