Fixed the generation of a null check before returning a value.

Signed-off-by: Dimitar Dobrev <dpldobrev@yahoo.com>