Fix a traceback when a group has no name and a crash when dns gets interrupted

- http://pastebin.archlinux.fr/449676
This commit is contained in:
mathieui 2012-08-31 22:41:36 +02:00
parent 2c95177fbe
commit 84887d17af
2 changed files with 19 additions and 4 deletions

View file

@ -33,9 +33,16 @@ def main():
cocore = singleton.Singleton(core.Core) cocore = singleton.Singleton(core.Core)
signal.signal(signal.SIGHUP, cocore.sighup_handler) # ignore ctrl-c signal.signal(signal.SIGHUP, cocore.sighup_handler) # ignore ctrl-c
cocore.start() cocore.start()
if not cocore.xmpp.start(): # Connect to remote server try:
cocore.on_failed_connection() if not cocore.xmpp.start(): # Connect to remote server
cocore.main_loop() # Refresh the screen, wait for user events etc cocore.on_failed_connection()
except:
cocore.running = False
cocore.reset_curses()
print("Poezio could not start, maybe you tried aborting it while it was starting?\n"
"If you think it is abnormal, please run it with the -d option and report the bug.")
else:
cocore.main_loop() # Refresh the screen, wait for user events etc
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View file

@ -95,7 +95,15 @@ class Roster(object):
def get_groups(self, sort=''): def get_groups(self, sort=''):
"""Return a list of the RosterGroups""" """Return a list of the RosterGroups"""
group_list = sorted(filter(lambda x: bool(x), self.groups.values()), key=lambda x: x.name.lower()) group_list = sorted(
filter(
lambda x: bool(x),
self.groups.values()
),
key=lambda x: x.name.lower() if x.name else ''
)
log.debug("Current groups: %s", group_list)
for sorting in sort.split(':'): for sorting in sort.split(':'):
if sorting == 'reverse': if sorting == 'reverse':