From bf1a6ecc2e5fd1cd67360be6c237d60d1612881b Mon Sep 17 00:00:00 2001 From: Ticki Date: Sat, 2 Apr 2016 18:24:47 +0200 Subject: [PATCH] Amend #15 --- src/size.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/size.rs b/src/size.rs index c8a57c6..2cca756 100644 --- a/src/size.rs +++ b/src/size.rs @@ -50,8 +50,8 @@ pub fn terminal_size() -> io::Result<(usize, usize)> { pub fn terminal_size() -> io::Result<(usize, usize)> { use std::env; - let width = env::var("COLUMNS").unwrap_or(String::new()).parse::().unwrap_or(0); - let height = env::var("LINES").unwrap_or(String::new()).parse::().unwrap_or(0); + let width = try!(env::var("COLUMNS").map_err(|x| io::Error::new(io::ErrorKind::NotFound, x))).parse().unwrap_or(0); + let height = try!(env::var("LINES").map_err(|x| io::Error::new(io::ErrorKind::NotFound, x))).parse().unwrap_or(0); Ok((width, height)) }