HPCC-9007 Improve on edge condition checking

When trying to replace attributes, wasn't checking for NULL values so may
run into segfaults. Also added the check for "/" so that attributes from
previous tags won't be affected.

Signed-off-by: mayx <yanrui.ma@lexisnexis.com>