Better error reporting for video drivers with less than full functionality.

This commit is contained in:
Sam Lantinga 2014-10-15 09:14:09 -07:00
parent 3b70f65dc1
commit f7abb7c4e2
1 changed files with 7 additions and 2 deletions

View File

@ -1339,6 +1339,10 @@ SDL_CreateWindowFrom(const void *data)
SDL_UninitializedVideo(); SDL_UninitializedVideo();
return NULL; return NULL;
} }
if (!_this->CreateWindowFrom) {
SDL_Unsupported();
return NULL;
}
window = (SDL_Window *)SDL_calloc(1, sizeof(*window)); window = (SDL_Window *)SDL_calloc(1, sizeof(*window));
if (!window) { if (!window) {
SDL_OutOfMemory(); SDL_OutOfMemory();
@ -1356,8 +1360,7 @@ SDL_CreateWindowFrom(const void *data)
} }
_this->windows = window; _this->windows = window;
if (!_this->CreateWindowFrom || if (_this->CreateWindowFrom(_this, window, data) < 0) {
_this->CreateWindowFrom(_this, window, data) < 0) {
SDL_DestroyWindow(window); SDL_DestroyWindow(window);
return NULL; return NULL;
} }
@ -3181,11 +3184,13 @@ SDL_GetWindowWMInfo(SDL_Window * window, struct SDL_SysWMinfo *info)
CHECK_WINDOW_MAGIC(window, SDL_FALSE); CHECK_WINDOW_MAGIC(window, SDL_FALSE);
if (!info) { if (!info) {
SDL_InvalidParamError("info");
return SDL_FALSE; return SDL_FALSE;
} }
info->subsystem = SDL_SYSWM_UNKNOWN; info->subsystem = SDL_SYSWM_UNKNOWN;
if (!_this->GetWindowWMInfo) { if (!_this->GetWindowWMInfo) {
SDL_Unsupported();
return SDL_FALSE; return SDL_FALSE;
} }
return (_this->GetWindowWMInfo(_this, window, info)); return (_this->GetWindowWMInfo(_this, window, info));