Skip to content

Commit 66034b6

Browse files
committed
Patch fixing redux: Trim trailing null characters
This fixes broken file operations
1 parent 4d23bf9 commit 66034b6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/common_file_operations.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ pub(crate) fn write_bool_as<T: std::convert::From<u8>>(x: &bool) -> T {
1919
}
2020

2121
pub(crate) fn read_string(byte_stream: Vec<u8>) -> String {
22-
String::from_utf8(byte_stream).unwrap()
22+
let str = String::from_utf8(byte_stream).unwrap();
23+
str.trim_matches(char::from(0)).to_string() // trim \0 from the end of strings
2324
}
2425

2526
pub(crate) fn write_string(str: &String) -> Vec<u8> {

0 commit comments

Comments
 (0)