1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

test_rtt: fix segfault when case not started

This commit is contained in:
Steffen Vogel 2017-12-20 11:34:18 +01:00
parent bfa8407665
commit fb3650918c

View file

@ -272,7 +272,7 @@ int test_rtt_stop(struct node *n)
int ret;
struct test_rtt *t = (struct test_rtt *) n->_vd;
if (t->counter != -1) {
if (t->counter >= 0) {
ret = test_rtt_case_stop(t, t->current);
if (ret)
return ret;
@ -289,7 +289,7 @@ int test_rtt_read(struct node *n, struct sample *smps[], unsigned cnt)
struct test_rtt *t = (struct test_rtt *) n->_vd;
if (t->counter == -1) {
if (t->current == -1) {
if (t->current < 0) {
t->current = 0;
}
else {
@ -355,6 +355,10 @@ int test_rtt_read(struct node *n, struct sample *smps[], unsigned cnt)
int test_rtt_write(struct node *n, struct sample *smps[], unsigned cnt)
{
struct test_rtt *t = (struct test_rtt *) n->_vd;
if (t->current < 0)
return 0;
struct test_rtt_case *c = (struct test_rtt_case *) list_at(&t->cases, t->current);
int i;