check for returned value before attempting to parse