cocoadisplay: don't crash if window/buffer fails to open

This commit is contained in:
rdb 2018-06-03 22:35:16 +02:00
parent eb960669a5
commit 57602d750f
2 changed files with 13 additions and 0 deletions

View File

@ -105,6 +105,12 @@ open_buffer() {
}
}
if (cocoagsg->_context == nil) {
// Could not obtain a proper context.
_gsg.clear();
return false;
}
FrameBufferProperties desired_props(_fb_properties);
// Lock the context, so we can safely operate on it.

View File

@ -362,6 +362,13 @@ open_window() {
}
}
if (cocoagsg->_context == nil) {
// Could not obtain a proper context.
_gsg.clear();
close_window();
return false;
}
// Fill in the blanks.
if (!_properties.has_origin()) {
_properties.set_origin(-2, -2);