diff options
author | hut <hut@lepus.uberspace.de> | 2015-10-20 13:06:25 +0200 |
---|---|---|
committer | hut <hut@lepus.uberspace.de> | 2015-10-20 13:06:25 +0200 |
commit | 7f40b26887e299517781602a01e245895dbffd17 (patch) | |
tree | 20838ed3f446e0edc5dfd8921d37b207b739046f | |
parent | c5f96b080c8115201ce2b1ce055141c4e3e5039a (diff) | |
download | ranger-7f40b26887e299517781602a01e245895dbffd17.tar.gz |
config/commands.py: fixed crashes in loading directories
fixed #357
-rw-r--r-- | ranger/config/commands.py | 8 |
1 files 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 |