Added a check for 'null' before getting the native pointer of a wrapped object.

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