PROV-911 Prevent type error in foreach() loop.

It is possible that getRepresentations() returns null, so we need to ensure that the return value is
actually an array before attempting to loop over it.