diff --git a/source/blender/editors/object/object_vgroup.cc b/source/blender/editors/object/object_vgroup.cc index c3bc18eb459..235a1b1ea61 100644 --- a/source/blender/editors/object/object_vgroup.cc +++ b/source/blender/editors/object/object_vgroup.cc @@ -1849,10 +1849,15 @@ static int inv_cmp_mdef_vert_weights(const void *a1, const void *a2) if (dw1->weight > dw2->weight) { return -1; } + + /* Compare address for stable sort algorithm. */ if (&dw1 < &dw2) { - return 1; /* compare address for stable sort algorithm */ + return 1; } - return -1; + if (&dw1 > &dw2) { + return -1; + } + return 0; } /* Used for limiting the number of influencing bones per vertex when exporting