From 6eeab148d93711a817143bc868589290eecdff80 Mon Sep 17 00:00:00 2001 From: panicbit Date: Mon, 29 Aug 2016 02:44:04 +0200 Subject: [PATCH] Fix Console fmt::Write impl --- src/console.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/console.rs b/src/console.rs index 123c067..6e05ec2 100644 --- a/src/console.rs +++ b/src/console.rs @@ -35,6 +35,10 @@ impl Default for Console { impl Write for Console { fn write_str(&mut self, s: &str) -> fmt::Result { + // Writing 0 bytes to the console fails + if s.is_empty() { + return Ok(()) + } unsafe { consoleSelect(&mut self.context); } let ret = unsafe { libc::write(libc::STDOUT_FILENO, s.as_ptr() as *const _, s.len()) }; if ret == s.len() as isize {