This section applies where, by virtue of any provision of this Code, the pre-sentence report requirements apply to a court in relation to forming an opinion.
If the offender is aged 18 or over, the court must obtain and consider a pre-sentence report before forming the opinion unless, in the circumstances of the case, it considers that it is unnecessary to obtain a pre-sentence report.
If the offender is aged under 18, the court must obtain and consider a pre-sentence report before forming the opinion unless—
that it is unnecessary to obtain a pre-sentence report.
Where a court does not obtain and consider a pre-sentence report before forming an opinion in relation to which the pre-sentence report requirements apply, no custodial sentence or community sentence is invalidated by the fact that it did not do so.