diff --git a/tools/libinput-debug-tablet.c b/tools/libinput-debug-tablet.c index 2848dc64..5e074261 100644 --- a/tools/libinput-debug-tablet.c +++ b/tools/libinput-debug-tablet.c @@ -277,8 +277,12 @@ handle_device_added(struct context *ctx, struct libinput_event *ev) devnode = udev_device_get_devnode(udev_device); if (devnode) { int fd = open(devnode, O_RDONLY | O_NONBLOCK | O_CLOEXEC); - assert(fd != -1); - assert(libevdev_new_from_fd(fd, &ctx->evdev) == 0); + if (fd == -1) + return; + if (libevdev_new_from_fd(fd, &ctx->evdev) != 0) { + close(fd); + return; + } ctx->fds[1].fd = fd; }