Skip to content

Commit

Permalink
Improve identification of preferred elements
Browse files Browse the repository at this point in the history
Fixes #799
  • Loading branch information
cgx committed Jun 22, 2017
1 parent 7f00afc commit 9bde9b6
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion SOPE/NGCards/NGVCard.m
Expand Up @@ -458,12 +458,22 @@ - (CardElement *) _preferredElementWithTag: (NSString *) aTag
elements = [self childrenWithTag: aTag];
if (elements && [elements count] > 0)
{
// First element of type "pref"
prefElements = [elements cardElementsWithAttribute: @"type"
havingValue: @"pref"];
if (prefElements && [prefElements count] > 0)
element = [prefElements objectAtIndex: 0];
else
element = [elements objectAtIndex: 0];
{
// First element of type "work"
prefElements = [elements cardElementsWithAttribute: @"type"
havingValue: @"work"];
if (prefElements && [prefElements count] > 0)
element = [prefElements objectAtIndex: 0];
else
// Fallback
element = [elements objectAtIndex: 0];
}
}
else
element = nil;
Expand Down

0 comments on commit 9bde9b6

Please sign in to comment.