pstats: Fix crash when frame has only level data and no time data

This commit is contained in:
rdb 2022-02-22 15:25:04 +01:00
parent a33fcab8da
commit 759115fbc7
2 changed files with 4 additions and 4 deletions

View File

@ -105,7 +105,7 @@ add_level(int index, double level) {
*/
INLINE double PStatFrameData::
get_start() const {
if (is_empty()) {
if (is_time_empty()) {
return 0.0;
}
@ -118,7 +118,7 @@ get_start() const {
*/
INLINE double PStatFrameData::
get_end() const {
nassertr(!is_empty(), 0.0);
nassertr(!is_time_empty(), 0.0);
return _time_data.back()._value;
}
@ -128,7 +128,7 @@ get_end() const {
*/
INLINE double PStatFrameData::
get_net_time() const {
nassertr(!is_empty(), 0.0);
nassertr(!is_time_empty(), 0.0);
return _time_data.back()._value - _time_data.front()._value;
}

View File

@ -267,7 +267,7 @@ record_new_frame(int frame_number, PStatFrameData *frame_data) {
double oldest_allowable_time = time - _history;
while (!_frames.empty() &&
(_frames.front() == nullptr ||
_frames.front()->is_empty() ||
_frames.front()->is_time_empty() ||
_frames.front()->get_start() < oldest_allowable_time)) {
delete _frames.front();
_frames.pop_front();