Prevent segfault from null connection

Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
Handle failures in sysfs scanning correctly

Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>