Changeset 9045

Show
Ignore:
Timestamp:
11/24/07 10:48:38 (12 months ago)
Author:
asterix
Message:

prevent traceback when we fill the roster. fixes #3579

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/common/contacts.py

    r9044 r9045  
    433433                show_list = ['not in roster', 'error', 'offline', 'invisible', 'dnd', 
    434434                        'xa', 'away', 'chat', 'online', 'requested', 'message'] 
    435                 show1 = show_list.index(contact1.show) 
    436                 show2 = show_list.index(contact2.show) 
     435                # contact can be null when we fill the roster on connection 
     436                if not contact1: 
     437                        show1 = 0 
     438                        priority1 = 0 
     439                else: 
     440                        show1 = show_list.index(contact1.show) 
     441                        priority1 = contact1.priority 
     442                if not contact1: 
     443                        show2 = 0 
     444                        priority2 = 0 
     445                else: 
     446                        show2 = show_list.index(contact2.show) 
     447                        priority2 = contact2.priority 
    437448                # If only one is offline, it's always second 
    438449                if show1 > 2 and show2 < 3: 
     
    451462                if transport1 and not transport2: 
    452463                        return -1 
    453                 if contact1.priority > contact2.priority: 
     464                if priority1 > priority2: 
    454465                        return 1 
    455                 if contact2.priority > contact1.priority: 
     466                if priority2 > priority1: 
    456467                        return -1 
    457468                if show1 > show2: