handle null value for a variable

Context
======
The addAsVariable() method throws a NullPointerException when a variable value is null.

Description
=========
The variable value is converted to a String by calling String.valueOf(), which convert null values to "null".