Merge pull request #12109 from JosJuice/android-adddevice-null

ControllerInterface/Android: Add null check to AddDevice
This commit is contained in:
Admiral H. Curtiss 2023-08-15 22:22:45 +02:00 committed by GitHub
commit 2cbc1e6f3e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -908,6 +908,12 @@ static void AddDevice(JNIEnv* env, int device_id)
jobject input_device =
env->CallStaticObjectMethod(s_input_device_class, s_input_device_get_device, device_id);
if (!input_device)
{
ERROR_LOG_FMT(CONTROLLERINTERFACE, "Could not find device with ID {}", device_id);
return;
}
auto device = std::make_shared<AndroidDevice>(env, input_device);
env->DeleteLocalRef(input_device);