}
manager_get_session_by_pid(m, leader, &session);
- if (!session && vtnr > 0)
- session = (vtnr < m->seat0->position_count) ? m->seat0->positions[vtnr] : NULL;
+ if (!session && vtnr > 0 && vtnr < m->seat0->position_count)
+ session = m->seat0->positions[vtnr];
if (session) {
_cleanup_free_ char *path = NULL;
_cleanup_close_ int fifo_fd = -1;