File tree 1 file changed +5
-5
lines changed
1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -40,11 +40,10 @@ impl io::Read for Stdin {
40
40
return Err ( io:: const_io_error!( io:: ErrorKind :: Interrupted , "Special Key Press" ) ) ;
41
41
}
42
42
43
- // The option unwrap is safe since iterator will have 1 element.
44
- let ch: char = char:: decode_utf16 ( [ inp] )
45
- . next ( )
46
- . unwrap ( )
47
- . map_err ( |_| io:: const_io_error!( io:: ErrorKind :: InvalidInput , "Invalid Input" ) ) ?;
43
+ let Some ( Ok ( ch) ) = char:: decode_utf16 ( [ inp] ) . next ( ) else {
44
+ return Err ( const_io_error ! ( io:: ErrorKind :: InvalidInput , "Invalid Input" ) ) ;
45
+ } ;
46
+
48
47
if ch. len_utf8 ( ) > buf. len ( ) {
49
48
self . pending = Some ( ch) ;
50
49
return Ok ( 0 ) ;
@@ -116,6 +115,7 @@ fn write(
116
115
} ;
117
116
118
117
let mut utf16: Vec < u16 > = utf8. encode_utf16 ( ) . collect ( ) ;
118
+ // NULL terminate the string
119
119
utf16. push ( 0 ) ;
120
120
121
121
unsafe { simple_text_output ( protocol, & mut utf16) } ?;
You can’t perform that action at this time.
0 commit comments