Skip to content

Commit

Permalink
Fix wrong assertion failure for console redirection (#5671)
Browse files Browse the repository at this point in the history
* Add null if nothing was read

* Update src/controller/c/robot.c

Co-authored-by: Olivier Michel <[email protected]>

Co-authored-by: Olivier Michel <[email protected]>
  • Loading branch information
ygoumaz and omichel authored Dec 21, 2022
1 parent 4218f49 commit b108cb3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/controller/c/robot.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,12 @@ void stream_pipe_read(int fd, char **buffer) {
if (len == -1)
len = 0;
#endif
(*buffer)[len] = '\0';
if (len != 0)
(*buffer)[len] = '\0';
else {
free(*buffer);
*buffer = NULL;
}
}

static void init_robot_window_library() {
Expand Down

0 comments on commit b108cb3

Please sign in to comment.