Function does not handle null values even if it was documented to handle them

Signed-off-by: Madhura Jayaratne <madhura.cj@gmail.com>