Skip to content

Commit

Permalink
Merge pull request #249 from dbsystel/fix-segfault
Browse files Browse the repository at this point in the history
Fix segfault if file descriptor unavailable.
  • Loading branch information
MrDOS committed Feb 9, 2024
2 parents 0df8b60 + af6139d commit b1da316
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/main/c/src/SerialImp.c
Expand Up @@ -3081,6 +3081,11 @@ int read_byte_array( JNIEnv *env,
struct event_info_struct *eis = ( struct event_info_struct * )
get_java_var_long( env, *jobj,"eis","J" );

if (eis == NULL) {
throw_java_exception(env, IO_EXCEPTION, "read_byte_array",
"Unable to read byte array");
return -1;
}
report_time_start();
flag = eis->eventflags[SPE_DATA_AVAILABLE];
eis->eventflags[SPE_DATA_AVAILABLE] = 0;
Expand Down

0 comments on commit b1da316

Please sign in to comment.