nm: Fix segfault when no device available

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>