[hal] Check for null in getSimDeviceName JNI (#5038)

This commit is contained in:
Peter Johnson
2023-02-01 23:25:55 -08:00
committed by GitHub
parent 2f96cae31a
commit a27a047ae8

View File

@@ -468,7 +468,11 @@ JNIEXPORT jstring JNICALL
Java_edu_wpi_first_hal_simulation_SimDeviceDataJNI_getSimDeviceName
(JNIEnv* env, jclass, jint handle)
{
return MakeJString(env, HALSIM_GetSimDeviceName(handle));
const char* name = HALSIM_GetSimDeviceName(handle);
if (!name) {
return nullptr;
}
return MakeJString(env, name);
}
/*