net: Check object before increasing refcount

Check if object is non-NULL before increasing its reference count.

Fixes e823b8fe63846a9c60ebd59a8bf07e9c602a8528.