From 83832f33c4b69942a700702473917ea4baba83e5 Mon Sep 17 00:00:00 2001 From: hut Date: Wed, 14 Apr 2010 15:37:59 +0200 Subject: widgets.statusbar: better error detection --- ranger/gui/widgets/statusbar.py | 13 ++++++++----- 1 file 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 -- cgit 1.4.1-2-gfad0