From 7677a4cbd4d70b47f9c7ac9bb575583a2e2c6136 Mon Sep 17 00:00:00 2001 From: Magnus Lundborg Date: Tue, 19 Nov 2013 09:25:50 +0100 Subject: Fail more elegantly if there are no particles when setting stride length. In that case do not reserve memory either. 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) { -- cgit v0.10.1