mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-20 00:51:41 +00:00
Assert that version checking won't throw on startup (#1512)
# Overview Previously if the coproc came up later, getProperty would return the string literal "null", which made us print the BFW. Add tests to make sure that we don't do that anymore by rebooting a sim coproc + robot in a combination of different orders.
This commit is contained in:
@@ -24,6 +24,17 @@
|
||||
|
||||
using namespace wpi::tsp;
|
||||
|
||||
#define CHECK_PTR(ptr) \
|
||||
if (!ptr) { \
|
||||
fmt::println("Got invalid pointer?? {}:{}", __FILE__, __LINE__); \
|
||||
return; \
|
||||
}
|
||||
#define CHECK_PTR_RETURN(ptr, default) \
|
||||
if (!ptr) { \
|
||||
fmt::println("Got invalid pointer?? {}:{}", __FILE__, __LINE__); \
|
||||
return default; \
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
|
||||
/*
|
||||
@@ -47,6 +58,7 @@ JNIEXPORT void JNICALL
|
||||
Java_org_photonvision_jni_TimeSyncServer_start
|
||||
(JNIEnv*, jclass, jlong ptr)
|
||||
{
|
||||
CHECK_PTR(ptr);
|
||||
TimeSyncServer* server = reinterpret_cast<TimeSyncServer*>(ptr);
|
||||
server->Start();
|
||||
}
|
||||
@@ -60,6 +72,7 @@ JNIEXPORT void JNICALL
|
||||
Java_org_photonvision_jni_TimeSyncServer_stop
|
||||
(JNIEnv*, jclass, jlong ptr)
|
||||
{
|
||||
CHECK_PTR(ptr);
|
||||
TimeSyncServer* server = reinterpret_cast<TimeSyncServer*>(ptr);
|
||||
server->Stop();
|
||||
delete server;
|
||||
|
||||
Reference in New Issue
Block a user