From e5fc8b35a20d1e5941dab1973f95a33d16af6ac8 Mon Sep 17 00:00:00 2001 From: ac-stef Date: Fri, 8 May 2015 15:44:05 +0200 Subject: [PATCH] be extremely pedantic with setvar and getvar in debug mode This will exit the program, if code tries to access a non-existing variable or an existing variable of the wrong type. --- source/src/command.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/source/src/command.cpp b/source/src/command.cpp index 46b78686..e14efcd9 100644 --- a/source/src/command.cpp +++ b/source/src/command.cpp @@ -206,6 +206,7 @@ char *svariable(const char *name, const char *cur, char **storage, void (*fun)() #define _GETVAR(id, vartype, name, retval) \ ident *id = idents->access(name); \ + ASSERT(id && id->type == vartype); \ if(!id || id->type!=vartype) return retval; #define GETVAR(id, name, retval) _GETVAR(id, ID_VAR, name, retval) void setvar(const char *name, int i, bool dofunc)