Skip to content

Commit e5bf1a2

Browse files
author
梶塚太智
committed
Update main.rs
1 parent d76e850 commit e5bf1a2

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/main.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -507,8 +507,10 @@ impl Executor {
507507
// ファイル読み込み
508508
"read-file" => {
509509
let name = self.pop_stack().get_string();
510-
self.stack
511-
.push(Type::String(get_file_contents(name).unwrap()));
510+
match get_file_contents(name) {
511+
Ok(s) => self.stack.push(Type::String(s)),
512+
Err(e) => self.log_print(format!("エラー! {}\n", e)),
513+
};
512514
}
513515

514516
// 標準入力

0 commit comments

Comments
 (0)