* bugfix for issue 164
This commit is contained in:
@ -317,6 +317,22 @@ struct _SortFuncData {
|
|||||||
};
|
};
|
||||||
typedef struct _SortFuncData SortFuncData;
|
typedef struct _SortFuncData SortFuncData;
|
||||||
|
|
||||||
|
static MuContainer*
|
||||||
|
get_top_msg (MuContainer *c, MuMsgFieldId mfid)
|
||||||
|
{
|
||||||
|
MuContainer *piv, *extreme = c;
|
||||||
|
for (piv = c; piv != NULL && piv->msg != NULL; piv = piv->child) {
|
||||||
|
if (mu_msg_cmp (piv->msg, extreme->msg, mfid) > 0)
|
||||||
|
extreme = piv;
|
||||||
|
if (piv != c && piv->next) {
|
||||||
|
MuContainer *sub = get_top_msg (piv->next, mfid);
|
||||||
|
|
||||||
|
if (sub->msg != NULL && mu_msg_cmp (sub->msg, extreme->msg, mfid) > 0)
|
||||||
|
extreme = sub;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return extreme;
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
sort_func_wrapper (MuContainer *a, MuContainer *b, SortFuncData *data)
|
sort_func_wrapper (MuContainer *a, MuContainer *b, SortFuncData *data)
|
||||||
@ -328,6 +344,9 @@ sort_func_wrapper (MuContainer *a, MuContainer *b, SortFuncData *data)
|
|||||||
for (a1 = a; a1->msg == NULL && a1->child != NULL; a1 = a1->child);
|
for (a1 = a; a1->msg == NULL && a1->child != NULL; a1 = a1->child);
|
||||||
for (b1 = b; b1->msg == NULL && b1->child != NULL; b1 = b1->child);
|
for (b1 = b; b1->msg == NULL && b1->child != NULL; b1 = b1->child);
|
||||||
|
|
||||||
|
a1 = get_top_msg (a1, data->mfid);
|
||||||
|
b1 = get_top_msg (b1, data->mfid);
|
||||||
|
|
||||||
if (a1 == b1)
|
if (a1 == b1)
|
||||||
return 0;
|
return 0;
|
||||||
else if (!a1->msg)
|
else if (!a1->msg)
|
||||||
|
|||||||
Reference in New Issue
Block a user