From d914e8d2d2196e96e478949854df85f273d92a84 Mon Sep 17 00:00:00 2001 From: Magnus Lundborg Date: Fri, 12 Dec 2014 00:36:29 +0100 Subject: Fixed bug reading last frame and time of last frame. Change-Id: I983333cc30b2d3add0b5a35e29b5d67736927cd4 diff --git a/src/lib/tng_io.c b/src/lib/tng_io.c index 6b467a8..237db3e 100644 --- a/src/lib/tng_io.c +++ b/src/lib/tng_io.c @@ -15649,7 +15649,7 @@ tng_function_status DECLSPECDLLEXPORT tng_util_particle_data_next_frame_read } else { - if(data->n_frames == 1) + if(data->n_frames == 1 && frame_set->n_frames == 1) { i = data->last_retrieved_frame + 1; } @@ -15813,7 +15813,7 @@ tng_function_status DECLSPECDLLEXPORT tng_util_non_particle_data_next_frame_read } else { - if(data->n_frames == 1) + if(data->n_frames == 1 && frame_set->n_frames == 1) { i = data->last_retrieved_frame + 1; } @@ -17507,6 +17507,10 @@ tng_function_status DECLSPECDLLEXPORT tng_util_trajectory_next_frame_present_dat { data_frame = data->first_frame_with_data; } + if(data_frame >= frame_set->first_frame + frame_set->n_frames) + { + continue; + } frame_diff = data_frame - current_frame; if(frame_diff < 0) { @@ -17594,6 +17598,10 @@ tng_function_status DECLSPECDLLEXPORT tng_util_trajectory_next_frame_present_dat { data_frame = data->first_frame_with_data; } + if(data_frame >= frame_set->first_frame + frame_set->n_frames) + { + continue; + } frame_diff = data_frame - current_frame; if(frame_diff < 0) { -- cgit v0.10.1