I've figured out this issue.
Essentially a logic flaw in an earlier block of code.
This if statement was part of a while block, and when this if statement was being evaluated, a condition in the earlier while block had changed which resulted in the while loop being exited and as a result the if statement not being executed
In short, user error, as usual