hidapi: improved error handling

This commit is contained in:
Sam Lantinga
2023-05-27 08:33:48 -07:00
parent 2666e15cf1
commit 211054d9db
3 changed files with 27 additions and 12 deletions

View File

@@ -133,7 +133,11 @@ static void register_error_str(wchar_t **error_str, const char *msg)
free(*error_str);
#ifdef HIDAPI_USING_SDL_RUNTIME
/* Thread-safe error handling */
SDL_SetError("%s", msg);
if (msg) {
SDL_SetError("%s", msg);
} else {
SDL_ClearError();
}
#else
*error_str = utf8_to_wchar_t(msg);
#endif