Skip to content
Snippets Groups Projects
Commit c336b3da authored by srosse's avatar srosse
Browse files

OO-1528: hardened the method against null

parent 9517dbe8
No related branches found
No related tags found
No related merge requests found
......@@ -50,6 +50,7 @@ public class IsUserFunction extends AbstractFunction {
/**
* @see com.neemsoft.jmep.FunctionCB#call(java.lang.Object[])
*/
@Override
public Object call(Object[] inStack) {/*
* argument check
*/
......@@ -74,13 +75,14 @@ public class IsUserFunction extends AbstractFunction {
}
Identity ident = getUserCourseEnv().getIdentityEnvironment().getIdentity();
String identName = ident.getName();
return identName.equals(userName) ? ConditionInterpreter.INT_TRUE: ConditionInterpreter.INT_FALSE;
if(ident == null || ident.getName() == null) {
return ConditionInterpreter.INT_FALSE;
}
return ident.getName().equals(userName) ? ConditionInterpreter.INT_TRUE: ConditionInterpreter.INT_FALSE;
}
@Override
protected Object defaultValue() {
return ConditionInterpreter.INT_TRUE;
}
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment