network: fix critical when opening VPN details page
I was seeing this critical when opening the VPN details page:
(gnome-control-center:78888): nm-CRITICAL **: 16:26:21.689: ((src/libnm-client-impl/nm-device.c:1299)): assertion '' failed
It probably broke in 551d7228. The code above and below expects self->device may be NULL, so let's add a NULL check here.