Only delete existing fields. Scalar ts objects may not have all those fields. This change checks a field exists before deleting it, thus avoiding an error.
Dear @chasapis,
thank you for this contribution. This code looks good to me. (I took the liberty to change the target branch to our devel branch, in accordance with our contributing guidelines).
Only delete existing fields. Scalar ts objects may not have all those fields. This change checks a field exists before deleting it, thus avoiding an error.