fix crashes
This commit is contained in:
parent
b7499885aa
commit
a282ff9218
|
|
@ -126,8 +126,6 @@ get_frame(int frame_number) const {
|
|||
}
|
||||
}
|
||||
|
||||
PStatFrameData * const *array = &_frames[0];
|
||||
|
||||
if (rel_frame >= 0 && rel_frame < num_frames) {
|
||||
nassertr(_frames[rel_frame] != (PStatFrameData *)NULL, _null_frame);
|
||||
nassertr(_frames[rel_frame]->get_start() >= 0.0, _null_frame);
|
||||
|
|
@ -256,17 +254,19 @@ get_frame_rate(float time) const {
|
|||
|
||||
int then_i = now_i;
|
||||
int last_good_i = now_i;
|
||||
PStatFrameData * const *array = &_frames[0];
|
||||
|
||||
nassertr(then_i < 0 || _frames[then_i] != (PStatFrameData *)NULL, 0.0);
|
||||
while (then_i > 0 && _frames[then_i]->get_start() > then) {
|
||||
last_good_i = then_i;
|
||||
then_i--;
|
||||
while (then_i > 0 && _frames[then_i] == (PStatFrameData *)NULL) {
|
||||
then_i--;
|
||||
while (then_i >= 0) {
|
||||
const PStatFrameData *frame = _frames[then_i];
|
||||
if (frame != (PStatFrameData *)NULL) {
|
||||
if (frame->get_start() > then) {
|
||||
last_good_i = then_i;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
nassertr(then_i < 0 || _frames[then_i] != (PStatFrameData *)NULL, 0.0);
|
||||
then_i--;
|
||||
}
|
||||
|
||||
nassertr(last_good_i >= 0, 0.0);
|
||||
nassertr(_frames[last_good_i] != (PStatFrameData *)NULL, 0.0);
|
||||
|
||||
|
|
|
|||
|
|
@ -349,8 +349,14 @@ update_time_data(const PStatFrameData &frame_data) {
|
|||
if (_client_data->get_child_distance(_constraint, collector_index) >= 0) {
|
||||
// Here's a data point we care about: anything at constraint
|
||||
// level or below.
|
||||
samples[collector_index].data_point(frame_data.get_time(i), is_start, started);
|
||||
got_samples.insert(collector_index);
|
||||
if (is_start == samples[collector_index]._is_started) {
|
||||
nout << "Unexpected data point for "
|
||||
<< _client_data->get_collector_fullname(collector_index)
|
||||
<< "\n";
|
||||
} else {
|
||||
samples[collector_index].data_point(frame_data.get_time(i), is_start, started);
|
||||
got_samples.insert(collector_index);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue