From 2866916469e8d62bc7b0a5d0f697eff1375a1881 Mon Sep 17 00:00:00 2001 From: Kevin Chabowski Date: Mon, 5 Aug 2013 15:10:04 +0200 Subject: Iteration values must be in ascending order! --- config.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/config.c b/config.c index 72843e8..d810d8f 100644 --- a/config.c +++ b/config.c @@ -97,6 +97,7 @@ conf_load(char* path, config_t** conf) { int i; dictionary* ini = NULL; char namebuf[NAMEBUF_SIZE]; + int last_iter = 0; if(!(*conf = malloc(sizeof(config_t)))) { fputs("Could not allocate memory.\n", stderr); @@ -164,6 +165,12 @@ conf_load(char* path, config_t** conf) { goto failed; } + if((*conf)->iters[i] <= last_iter) { + fputs("iterX values must be in ascending order.\n", stderr); + goto failed; + } + last_iter = (*conf)->iters[i]; + if(snprintf(namebuf, NAMEBUF_SIZE, "nebula2:color%d", i) < 0) { fputs("Error while reading colorX values.\n", stderr); goto failed; -- cgit v1.2.3-54-g00ecf