diff --git a/src/editor.rs b/src/editor.rs index e3c9f70..9b0b0b1 100644 --- a/src/editor.rs +++ b/src/editor.rs @@ -63,7 +63,10 @@ impl Editor { } pub fn new_from_file(path: &Path) -> Editor { - let buf = load_file_to_buffer(path).unwrap(); + let buf = match load_file_to_buffer(path) { + Ok(b) => {b}, + _ => {Buffer::new()} + }; let mut ed = Editor { buffer: buf,