A check for zero energy or weight is added.