mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 19:08:55 -04:00
fix crash when no active tasks
This commit is contained in:
parent
00a3bd8462
commit
eccea893f3
@ -1357,19 +1357,21 @@ do_write(ostream &out, int indent_level) const {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sort(tasks.begin(), tasks.end(), AsyncTaskSortPriority());
|
|
||||||
|
|
||||||
double now = _manager->_clock->get_frame_time();
|
double now = _manager->_clock->get_frame_time();
|
||||||
|
|
||||||
|
if (!tasks.empty()) {
|
||||||
|
sort(tasks.begin(), tasks.end(), AsyncTaskSortPriority());
|
||||||
|
TaskHeap::reverse_iterator ti;
|
||||||
|
int current_sort = tasks.back()->get_sort() - 1;
|
||||||
|
|
||||||
// Since AsyncTaskSortPriority() sorts backwards (because of STL's
|
// Since AsyncTaskSortPriority() sorts backwards (because of STL's
|
||||||
// push_heap semantics), we go through the task list in reverse
|
// push_heap semantics), we go through the task list in reverse
|
||||||
// order to print them forwards.
|
// order to print them forwards.
|
||||||
TaskHeap::reverse_iterator ti;
|
|
||||||
int current_sort = tasks.back()->get_sort() - 1;
|
|
||||||
for (ti = tasks.rbegin(); ti != tasks.rend(); ++ti) {
|
for (ti = tasks.rbegin(); ti != tasks.rend(); ++ti) {
|
||||||
AsyncTask *task = (*ti);
|
AsyncTask *task = (*ti);
|
||||||
write_task_line(out, indent_level, task, now);
|
write_task_line(out, indent_level, task, now);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Instead of iterating through the _sleeping list in heap order,
|
// Instead of iterating through the _sleeping list in heap order,
|
||||||
// copy it and then use repeated pops to get it out in sorted
|
// copy it and then use repeated pops to get it out in sorted
|
||||||
|
Loading…
x
Reference in New Issue
Block a user