tap: fix NULL dereference when passing invalid parameters to tap