From f7abb7c4e2313d23dd5773e8d85a70c317652224 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 15 Oct 2014 09:14:09 -0700 Subject: [PATCH] Better error reporting for video drivers with less than full functionality. --- src/video/SDL_video.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c index 0bb5f28bc..cd2a6a033 100644 --- a/src/video/SDL_video.c +++ b/src/video/SDL_video.c @@ -1339,6 +1339,10 @@ SDL_CreateWindowFrom(const void *data) SDL_UninitializedVideo(); return NULL; } + if (!_this->CreateWindowFrom) { + SDL_Unsupported(); + return NULL; + } window = (SDL_Window *)SDL_calloc(1, sizeof(*window)); if (!window) { SDL_OutOfMemory(); @@ -1356,8 +1360,7 @@ SDL_CreateWindowFrom(const void *data) } _this->windows = window; - if (!_this->CreateWindowFrom || - _this->CreateWindowFrom(_this, window, data) < 0) { + if (_this->CreateWindowFrom(_this, window, data) < 0) { SDL_DestroyWindow(window); return NULL; } @@ -3181,11 +3184,13 @@ SDL_GetWindowWMInfo(SDL_Window * window, struct SDL_SysWMinfo *info) CHECK_WINDOW_MAGIC(window, SDL_FALSE); if (!info) { + SDL_InvalidParamError("info"); return SDL_FALSE; } info->subsystem = SDL_SYSWM_UNKNOWN; if (!_this->GetWindowWMInfo) { + SDL_Unsupported(); return SDL_FALSE; } return (_this->GetWindowWMInfo(_this, window, info));