Fix: Crash when using "On Selected Markers" mode for Propogate Pose with no markers present

The function to get a list of markers was not clearing the list before it exited
early, and with no way to tell that the method failed, callers could make the
mistake of trusting that the list was now valid (i.e. either full of marker
frames or empty, vs being invalid)
This commit is contained in:
Joshua Leung 2015-04-02 23:47:55 +13:00
parent 838c3503a7
commit f30b60d139
1 changed files with 13 additions and 1 deletions

View File

@ -266,8 +266,20 @@ void ED_markers_make_cfra_list(ListBase *markers, ListBase *lb, short only_sel)
{
TimeMarker *marker;
if (markers == NULL)
if (lb) {
/* Clear the list first, since callers have no way of knowing
* whether this terminated early otherwise. This may lead
* to crashes if the user didn't clear the memory first.
*/
lb->first = lb->last = NULL;
}
else {
return;
}
if (markers == NULL) {
return;
}
for (marker = markers->first; marker; marker = marker->next)
add_marker_to_cfra_elem(lb, marker, only_sel);