manage when undefined is given to the filter

This pr fix the case when the object is undefined.
Could this be `if ( !obj ) {` ?