MFC r273488:
Fix some bugs in the error handling of getdevice().

PR:	194506