Skip to content

Commit

Permalink
Bug fix
Browse files Browse the repository at this point in the history
crashed when no command line argument was passed
  • Loading branch information
sh-zam committed Feb 6, 2019
1 parent 7f3f40f commit db965b1
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@ impl AppState {

// Lua arg
let mut cmd_args = self.init_args.clone();
// if no command line argument is passed, push current working directory
if cmd_args.is_empty() {
cmd_args.push(String::from("."));
}

// if file path is symlink, then resolve
match fs::read_link(&cmd_args[0]) {
Ok(p) => cmd_args[0] = String::from(p.to_str().unwrap_or("")),
Expand Down

0 comments on commit db965b1

Please sign in to comment.