Skip to content

Commit b1da316

Browse files
authored
Merge pull request #249 from dbsystel/fix-segfault
Fix segfault if file descriptor unavailable.
2 parents 0df8b60 + af6139d commit b1da316

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/main/c/src/SerialImp.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3081,6 +3081,11 @@ int read_byte_array( JNIEnv *env,
30813081
struct event_info_struct *eis = ( struct event_info_struct * )
30823082
get_java_var_long( env, *jobj,"eis","J" );
30833083

3084+
if (eis == NULL) {
3085+
throw_java_exception(env, IO_EXCEPTION, "read_byte_array",
3086+
"Unable to read byte array");
3087+
return -1;
3088+
}
30843089
report_time_start();
30853090
flag = eis->eventflags[SPE_DATA_AVAILABLE];
30863091
eis->eventflags[SPE_DATA_AVAILABLE] = 0;

0 commit comments

Comments
 (0)