mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[hal] Properly error check readCANStreamSession (#6108)
This commit is contained in:
@@ -46,6 +46,7 @@ static JException canMessageNotFoundExCls;
|
||||
static JException canMessageNotAllowedExCls;
|
||||
static JException canNotInitializedExCls;
|
||||
static JException uncleanStatusExCls;
|
||||
static JException nullPointerEx;
|
||||
static JClass powerDistributionVersionCls;
|
||||
static JClass pwmConfigDataResultCls;
|
||||
static JClass canStatusCls;
|
||||
@@ -85,7 +86,8 @@ static const JExceptionInit exceptions[] = {
|
||||
&canMessageNotAllowedExCls},
|
||||
{"edu/wpi/first/hal/can/CANNotInitializedException",
|
||||
&canNotInitializedExCls},
|
||||
{"edu/wpi/first/hal/util/UncleanStatusException", &uncleanStatusExCls}};
|
||||
{"edu/wpi/first/hal/util/UncleanStatusException", &uncleanStatusExCls},
|
||||
{"java/lang/NullPointerException", &nullPointerEx}};
|
||||
|
||||
namespace hal {
|
||||
|
||||
@@ -212,6 +214,10 @@ void ReportCANError(JNIEnv* env, int32_t status, int message_id) {
|
||||
}
|
||||
}
|
||||
|
||||
void ThrowNullPointerException(JNIEnv* env, std::string_view msg) {
|
||||
nullPointerEx.Throw(env, msg);
|
||||
}
|
||||
|
||||
void ThrowCANStreamOverflowException(JNIEnv* env, jobjectArray messages,
|
||||
jint length) {
|
||||
static jmethodID constructor =
|
||||
|
||||
Reference in New Issue
Block a user