Fixed a bug in the helper is_user_owns_resource() function where resource object retrieved for the given resource_id can be null. The code now checks if the retrieved resource object is null or not before using accessing any properties of this object.