mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2024-12-16 11:06:49 +01:00
Better fix for bug 3048, don't crash if the window title is NULL
This commit is contained in:
parent
d0ba0c1d8a
commit
396b3b8992
@ -1241,8 +1241,9 @@ void
|
|||||||
Cocoa_SetWindowTitle(_THIS, SDL_Window * window)
|
Cocoa_SetWindowTitle(_THIS, SDL_Window * window)
|
||||||
{ @autoreleasepool
|
{ @autoreleasepool
|
||||||
{
|
{
|
||||||
|
const char *title = window->title ? window->title : "";
|
||||||
NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow;
|
NSWindow *nswindow = ((SDL_WindowData *) window->driverdata)->nswindow;
|
||||||
NSString *string = [[NSString alloc] initWithUTF8String:window->title];
|
NSString *string = [[NSString alloc] initWithUTF8String:title];
|
||||||
[nswindow setTitle:string];
|
[nswindow setTitle:string];
|
||||||
[string release];
|
[string release];
|
||||||
}}
|
}}
|
||||||
@ -1428,7 +1429,7 @@ Cocoa_SetWindowBordered(_THIS, SDL_Window * window, SDL_bool bordered)
|
|||||||
{ @autoreleasepool
|
{ @autoreleasepool
|
||||||
{
|
{
|
||||||
if (SetWindowStyle(window, GetWindowStyle(window))) {
|
if (SetWindowStyle(window, GetWindowStyle(window))) {
|
||||||
if (bordered && window->title) {
|
if (bordered) {
|
||||||
Cocoa_SetWindowTitle(_this, window); /* this got blanked out. */
|
Cocoa_SetWindowTitle(_this, window); /* this got blanked out. */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1499,7 +1500,7 @@ Cocoa_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display
|
|||||||
s_moveHack = SDL_GetTicks();
|
s_moveHack = SDL_GetTicks();
|
||||||
|
|
||||||
/* When the window style changes the title is cleared */
|
/* When the window style changes the title is cleared */
|
||||||
if (!fullscreen && window->title) {
|
if (!fullscreen) {
|
||||||
Cocoa_SetWindowTitle(_this, window);
|
Cocoa_SetWindowTitle(_this, window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user