Index: src/XMPPPresence.m ================================================================== --- src/XMPPPresence.m +++ src/XMPPPresence.m @@ -209,10 +209,11 @@ } - (of_comparison_result_t)compare: (id )object { XMPPPresence *otherPresence; + OFNumber *otherPriority; OFString *otherShow; of_comparison_result_t priorityOrder; if (object == self) return OF_ORDERED_SAME; @@ -221,12 +222,19 @@ @throw [OFInvalidArgumentException exceptionWithClass: [self class] selector: _cmd]; otherPresence = (XMPPPresence*)object; + otherPriority = [otherPresence priority]; + if (otherPriority == nil) + otherPriority = [OFNumber numberWithInt8: 0]; - priorityOrder = [priority compare: [otherPresence priority]]; + if (priority != nil) + priorityOrder = [priority compare: otherPriority]; + else + priorityOrder = + [[OFNumber numberWithInt8: 0] compare: otherPriority]; if (priorityOrder != OF_ORDERED_SAME) return priorityOrder; otherShow = [otherPresence show];