scanner: don't create a CastDevice unless we intend to emit it

Otherwise, we would have an uncaught exception if an error happens on
this device.