mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-05-25 14:09:10 +00:00
Fixed crash in hid_init() if the HIDDeviceManager isn't available
This commit is contained in:
parent
2e92e94ebb
commit
34719cba96
1 changed files with 1 additions and 7 deletions
|
@ -1031,7 +1031,7 @@ extern "C"
|
||||||
|
|
||||||
int hid_init(void)
|
int hid_init(void)
|
||||||
{
|
{
|
||||||
if ( !g_initialized )
|
if ( !g_initialized && g_HIDDeviceManagerCallbackHandler )
|
||||||
{
|
{
|
||||||
// HIDAPI doesn't work well with Android < 4.3
|
// HIDAPI doesn't work well with Android < 4.3
|
||||||
if (SDL_GetAndroidSDKVersion() >= 18) {
|
if (SDL_GetAndroidSDKVersion() >= 18) {
|
||||||
|
@ -1040,12 +1040,6 @@ int hid_init(void)
|
||||||
g_JVM->AttachCurrentThread( &env, NULL );
|
g_JVM->AttachCurrentThread( &env, NULL );
|
||||||
pthread_setspecific( g_ThreadKey, (void*)env );
|
pthread_setspecific( g_ThreadKey, (void*)env );
|
||||||
|
|
||||||
if ( !g_HIDDeviceManagerCallbackHandler )
|
|
||||||
{
|
|
||||||
LOGV( "hid_init() without callback handler" );
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Bluetooth is currently only used for Steam Controllers, so check that hint
|
// Bluetooth is currently only used for Steam Controllers, so check that hint
|
||||||
// before initializing Bluetooth, which will prompt the user for permission.
|
// before initializing Bluetooth, which will prompt the user for permission.
|
||||||
bool init_usb = true;
|
bool init_usb = true;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue