Cleanup: ensure logically correct sort callback (id_order_compare)

Ref: !138299
This commit is contained in:
Campbell Barton
2025-05-02 12:39:24 +00:00
parent 276fac2294
commit f59cd876ad

View File

@@ -2527,6 +2527,10 @@ static bool id_order_compare(ID *a, ID *b)
int *order_a = id_order_get(a);
int *order_b = id_order_get(b);
/* In practice either both or neither are set,
* failing to do this would result in a logically invalid sort function, see #137712. */
BLI_assert((order_a && order_b) || (!order_a && !order_b));
if (order_a && order_b) {
if (*order_a < *order_b) {
return true;