diff options
author | hut <hut@lavabit.com> | 2010-04-14 15:37:59 +0200 |
---|---|---|
committer | hut <hut@lavabit.com> | 2010-04-14 15:37:59 +0200 |
commit | 83832f33c4b69942a700702473917ea4baba83e5 (patch) | |
tree | 8d71cc1990c8d9ada2ac77b175d0c1c11a988577 | |
parent | 50d31c9d7956dc10e3684842cd083860956ac2b3 (diff) | |
download | ranger-83832f33c4b69942a700702473917ea4baba83e5.tar.gz |
widgets.statusbar: better error detection
-rw-r--r-- | ranger/gui/widgets/statusbar.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/ranger/gui/widgets/statusbar.py b/ranger/gui/widgets/statusbar.py index db415129..52425943 100644 --- a/ranger/gui/widgets/statusbar.py +++ b/ranger/gui/widgets/statusbar.py @@ -145,15 +145,18 @@ class StatusBar(Widget): target = self.column.target.pointed_obj else: target = self.env.at_level(0).pointed_obj - if target is None or not target.accessible: + try: + stat = target.stat + except: + return + if stat is None: return perms = target.get_permission_string() - how = getuid() == target.stat.st_uid and 'good' or 'bad' + how = getuid() == stat.st_uid and 'good' or 'bad' left.add(perms, 'permissions', how) - left.add_space() - left.add(str(target.stat.st_nlink), 'nlink') + left.add(str(stat.st_nlink), 'nlink') left.add_space() left.add(self._get_owner(target), 'owner') left.add_space() @@ -169,7 +172,7 @@ class StatusBar(Widget): left.add_space() left.add(strftime(self.timeformat, - localtime(target.stat.st_mtime)), 'mtime') + localtime(stat.st_mtime)), 'mtime') def _get_owner(self, target): uid = target.stat.st_uid |