mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-12-12 11:33:02 +01:00
scan-build thinks there could be a `NULL` pointer dereference of `t->data` here. It’s wrong, so add an assertion to try and help it understand the control flow. The loop is exited as soon as a target is found whose weight is greater than or equal to a random value between 0 and the sum of all the weights in the set of remaining targets in the loop. By definition, the last target in the loop always satisfies this condition, so a target will always be chosen, and hence `t` will never be `NULL` within the loop. `t->data` will never be `NULL` by construction of the target list. Signed-off-by: Philip Withnall <pwithnall@gnome.org> Helps: #1767
7.5 KiB
7.5 KiB