Commit e28b10d5 authored by Alan McGovern's avatar Alan McGovern Committed by Aleksander Morgado

quartz: Null check title before setting it

This avoids a crash in objective-c.

https://bugzilla.gnome.org/show_bug.cgi?id=695278
parent b0ccdae7
...@@ -2642,9 +2642,11 @@ gdk_quartz_window_set_decorations (GdkWindow *window, ...@@ -2642,9 +2642,11 @@ gdk_quartz_window_set_decorations (GdkWindow *window,
* NSTitledWindowMask. This behaved extremely oddly when * NSTitledWindowMask. This behaved extremely oddly when
* conditionalized upon that and since it has no side effects (i.e. * conditionalized upon that and since it has no side effects (i.e.
* if NSTitledWindowMask is not requested, the title will not be * if NSTitledWindowMask is not requested, the title will not be
* displayed) just do it unconditionally. * displayed) just do it unconditionally. We also must null check
* 'title' before setting it to avoid crashing.
*/ */
[impl->toplevel setTitle:title]; if (title)
[impl->toplevel setTitle:title];
} }
else else
{ {
...@@ -2664,7 +2666,8 @@ gdk_quartz_window_set_decorations (GdkWindow *window, ...@@ -2664,7 +2666,8 @@ gdk_quartz_window_set_decorations (GdkWindow *window,
screen:screen]; screen:screen];
[impl->toplevel setHasShadow: window_type_hint_to_shadow (impl->type_hint)]; [impl->toplevel setHasShadow: window_type_hint_to_shadow (impl->type_hint)];
[impl->toplevel setLevel: window_type_hint_to_level (impl->type_hint)]; [impl->toplevel setLevel: window_type_hint_to_level (impl->type_hint)];
[impl->toplevel setTitle:title]; if (title)
[impl->toplevel setTitle:title];
[impl->toplevel setBackgroundColor:bg]; [impl->toplevel setBackgroundColor:bg];
[impl->toplevel setHidesOnDeactivate: window_type_hint_to_hides_on_deactivate (impl->type_hint)]; [impl->toplevel setHidesOnDeactivate: window_type_hint_to_hides_on_deactivate (impl->type_hint)];
[impl->toplevel setContentView:old_view]; [impl->toplevel setContentView:old_view];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment