make uninitialized global and local variables cause exception.
This commit is contained in:
1 parent
90540d3c44
commit
f3b66d9770
3 files changed
+7
-2
No files matched your search
+5
-1
@@ -80,7 +80,9 @@ namespace jet {
|
||||
} else {
|
||||
renderVariableName(variable, name, modifier, lvariables);
|
||||
name.split(".");
|
||||
if(name.getList().size() == 1) {
|
||||
if(name.getList().size() == 1) {
|
||||
if(variables.find(name[0]) == variables.end())
|
||||
throw coreutils::Exception("global variable is not initialized.");
|
||||
return processModifier(variables[name[0]], modifier);
|
||||
}
|
||||
return getSessionVariable(name);
|
||||
@@ -90,6 +92,8 @@ namespace jet {
|
||||
coreutils::MString name;
|
||||
coreutils::MString modifier;
|
||||
renderVariableName(variable, name, modifier, lvariables);
|
||||
if(lvariables.find(name) == lvariables.end())
|
||||
throw coreutils::Exception("local variable is not initialized.");
|
||||
return lvariables[name];
|
||||
}
|
||||
throw coreutils::Exception("Expecting a variable initializer ('$[' or '#[').");
|
||||
|
||||
Reference in new issue
Block a user