diff options
author | Magnus Lundborg <lundborg.magnus@gmail.com> | 2013-11-19 08:25:50 (GMT) |
---|---|---|
committer | Magnus Lundborg <lundborg.magnus@gmail.com> | 2013-11-19 08:25:50 (GMT) |
commit | 7677a4cbd4d70b47f9c7ac9bb575583a2e2c6136 (patch) | |
tree | a8d19e4cf4b1c1debcefc5dc824a973d4818d4a8 /src | |
parent | f65c3b9d3bfcbfdf41429280f5da4d5483538899 (diff) |
Fail more elegantly if there are no particles when setting stride length.
In that case do not reserve memory either.
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/tng_io.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/lib/tng_io.c b/src/lib/tng_io.c index 850c4ef..29cf246 100644 --- a/src/lib/tng_io.c +++ b/src/lib/tng_io.c @@ -15005,6 +15005,10 @@ tng_function_status DECLSPECDLLEXPORT tng_util_generic_write_interval_set if(particle_dependency == TNG_PARTICLE_BLOCK_DATA) { tng_num_particles_get(tng_data, &n_particles); + if(n_particles <= 0) + { + return(TNG_FAILURE); + } if(tng_particle_data_find(tng_data, block_id, &p_data) != TNG_SUCCESS) @@ -15144,6 +15148,11 @@ tng_function_status DECLSPECDLLEXPORT tng_util_generic_write_interval_double_set { tng_num_particles_get(tng_data, &n_particles); + if(n_particles <= 0) + { + return(TNG_FAILURE); + } + if(tng_particle_data_find(tng_data, block_id, &p_data) != TNG_SUCCESS) { |