Skip to content

Commit

Permalink
lib: Make io_loop_move_*(NULL) no-op
Browse files Browse the repository at this point in the history
  • Loading branch information
cmouse committed Aug 24, 2018
1 parent 0d7918a commit e5d0be5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/lib/ioloop.c
Expand Up @@ -1095,6 +1095,9 @@ struct io *io_loop_move_io_to(struct ioloop *ioloop, struct io **_io)
struct io *old_io = *_io;
struct io_file *old_io_file, *new_io_file;

if (old_io == NULL)
return NULL;

i_assert((old_io->condition & IO_NOTIFY) == 0);

if (old_io->ioloop == ioloop)
Expand Down Expand Up @@ -1130,7 +1133,7 @@ struct timeout *io_loop_move_timeout_to(struct ioloop *ioloop,
{
struct timeout *new_to, *old_to = *_timeout;

if (old_to->ioloop == ioloop)
if (old_to == NULL || old_to->ioloop == ioloop)
return old_to;

new_to = timeout_copy(old_to, ioloop);
Expand Down

0 comments on commit e5d0be5

Please sign in to comment.