Avoiding segfaults on device scanning

Authored by cjlcarvalho on Oct 12 2018, 6:07 PM.