diff --git a/src/shared/ptyfwd.c b/src/shared/ptyfwd.c index fe17b3781a..6d67c079e4 100644 --- a/src/shared/ptyfwd.c +++ b/src/shared/ptyfwd.c @@ -572,9 +572,11 @@ int pty_forward_set_priority(PTYForward *f, int64_t priority) { int r; assert(f); - r = sd_event_source_set_priority(f->stdin_event_source, priority); - if (r < 0) - return r; + if (f->stdin_event_source) { + r = sd_event_source_set_priority(f->stdin_event_source, priority); + if (r < 0) + return r; + } r = sd_event_source_set_priority(f->stdout_event_source, priority); if (r < 0)