diff --git a/src/Amalgam/entity/Entity.h b/src/Amalgam/entity/Entity.h index 0df7d827..62b18755 100644 --- a/src/Amalgam/entity/Entity.h +++ b/src/Amalgam/entity/Entity.h @@ -325,7 +325,7 @@ class Entity //Evaluates the specified label into a string and puts the value in value_out. //If the label exists, sets value_out to the value and returns true. // Otherwise sets value_out to empty string and returns false - std::pair GetValueAtLabelAsString(StringInternPool::StringID label_sid, bool on_self = false); + std::pair GetValueAtLabelAsString(StringInternPool::StringID label_sid, bool on_self = false); //Evaluates the specified label into a EvaluableNodeImmediateValueWithType //if destination_temp_enm is not null and code is needed, it will make a copy diff --git a/src/Amalgam/interpreter/Interpreter.h b/src/Amalgam/interpreter/Interpreter.h index a41b5030..bbdc1bb5 100644 --- a/src/Amalgam/interpreter/Interpreter.h +++ b/src/Amalgam/interpreter/Interpreter.h @@ -515,7 +515,7 @@ class Interpreter return InterpretNode(n, immediate_result); } - //computes a unary numeric function on the given node + //computes a unary numeric function on the given node, returns an ENT_NULL if n is interpreted as an ENT_NULL __forceinline EvaluableNodeReference InterpretNodeUnaryNumericOperation(EvaluableNode *n, bool immediate_result, std::function func) { @@ -526,6 +526,8 @@ class Interpreter } auto retval = InterpretNodeIntoUniqueNumberValueOrNullEvaluableNode(n); + if(retval->GetType() == ENT_NULL) + return retval; double value = retval->GetNumberValue(); double result = func(value); retval->SetTypeViaNumberValue(result);