Support default value for FFI

Add null check.