Changeset 9046

Show
Ignore:
Timestamp:
11/24/07 10:49:52 (13 months ago)
Author:
asterix
Message:

prevent traceback when we fill the roster on startup. see #3579

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/gajim_0.11.3-bugfixes/src/common/contacts.py

    r9027 r9046  
    398398                show_list = ['not in roster', 'error', 'offline', 'invisible', 'dnd', 
    399399                        'xa', 'away', 'chat', 'online', 'requested', 'message'] 
    400                 show1 = show_list.index(contact1.show) 
    401                 show2 = show_list.index(contact2.show) 
     400                # contact can be null when we fill the roster on connection 
     401                if not contact1: 
     402                        show1 = 0 
     403                        priority1 = 0 
     404                else: 
     405                        show1 = show_list.index(contact1.show) 
     406                        priority1 = contact1.priority 
     407                if not contact1: 
     408                        show2 = 0 
     409                        priority2 = 0 
     410                else: 
     411                        show2 = show_list.index(contact2.show) 
     412                        priority2 = contact2.priority 
    402413                # If only one is offline, it's always second 
    403414                if show1 > 2 and show2 < 3: 
     
    416427                if transport1 and not transport2: 
    417428                        return -1 
    418                 if contact1.priority > contact2.priority: 
     429                if priority1 > priority2: 
    419430                        return 1 
    420                 if contact2.priority > contact1.priority: 
     431                if priority2 > priority1: 
    421432                        return -1 
    422433                if show1 > show2: