mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-28 07:48:37 -04:00
pstats: Fix crash when frame has only level data and no time data
This commit is contained in:
parent
a33fcab8da
commit
759115fbc7
@ -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;
|
||||
}
|
||||
|
@ -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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user