From 7f40b26887e299517781602a01e245895dbffd17 Mon Sep 17 00:00:00 2001 From: hut Date: Tue, 20 Oct 2015 13:06:25 +0200 Subject: config/commands.py: fixed crashes in loading directories fixed #357 --- ranger/config/commands.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ranger/config/commands.py b/ranger/config/commands.py index 9f0481ce..18615f4f 100644 --- a/ranger/config/commands.py +++ b/ranger/config/commands.py @@ -226,7 +226,7 @@ class shell(Command): else: before_word, start_of_word = self.line.rsplit(' ', 1) return (before_word + ' ' + file.shell_escaped_basename \ - for file in self.fm.thisdir.files \ + for file in self.fm.thisdir.files or [] \ if file.shell_escaped_basename.startswith(start_of_word)) class open_with(Command): @@ -548,7 +548,7 @@ class mark_tag(Command): def execute(self): cwd = self.fm.thisdir tags = self.rest(1).replace(" ","") - if not self.fm.tags: + if not self.fm.tags or not cwd.files: return for fileobj in cwd.files: try: @@ -1131,7 +1131,7 @@ class scout(Command): self.fm.thistab.last_search = regex self.fm.set_search_method(order="search") - if self.MARK in flags or self.UNMARK in flags: + if (self.MARK in flags or self.UNMARK in flags) and thisdir.files: value = flags.find(self.MARK) > flags.find(self.UNMARK) if self.FILTER in flags: for f in thisdir.files: @@ -1234,7 +1234,7 @@ class scout(Command): cwd = self.fm.thisdir pattern = self.pattern - if not pattern: + if not pattern or not cwd.files: return 0 if pattern == '.': return 0 -- cgit 1.4.1-2-gfad0